Could I assume that every powerful application would provide a command line/script input?
Even there are many many fancy widgets in current software, but I still think command line input mode in UI is still necessary nowadays, since command line/script input is more straight forward and neat. If application could provide more domain specific script language, that would be more powerful.
Is there some book provide some theory on this? Effective UI?
You ask about books related to the theory of this. The theory is one of separating presentation logic from business logic, or separation of concerns. This goes by many names such as model/view/controller, model/view/presenter, and many others, and there are plenty of books on the subject.
If you design an application this way, the presentation layer (ie: user interface) is a separate entity that can be replaced with another. Thus, you could have a graphical user interface as well as a textual one. Arguably, in a perfect world all apps would work this way, with a desktop UI, a web UI, a command line UI, and so on.
This all comes at a great cost, however. It is difficult to design applications in this way and, because of the loose coupling between the application and the UI there may be performance penalties. To further add to the difficulty, it is inherently difficult to provide a rich command line interface to a complex application. How would you go about creating command line input to Adobe photoshop or Microsoft Excel, for example?
So while it's possible in a theoretical sense, from a practical sense it becomes more difficult as the complexity of the UI goes up. There are many applications that are able to accomplish this, however. For example, many version control systems such as BitKeeper, AccuRev and others have both command line and graphical interfaces.
So, yes, it's possible that most applications could implement both a graphical UI and a command line UI, and it's true that a few of them do, it's not reasonable to expect that all applications will or even can.
Related
I am developing a text with Python and Qt that can be used by blind and visually impaired people.
The text editor should be suitable for screen readers.
I do tests with the screen readers NVDA (Windows) and
Orca (Ubuntu).
Texts for screen readers should actually be saved in the "AccessibleDescription" property. The NVDA screen reader does not read the "AccessibleDescription" property. AccessibleName property only. The Orca screen reader reads the "AccessibleDescription" property.
Question:
What can I do so that my application is screen-readable on all operating systems?
Short answer
Sadly, there's probably no magic solution here.
The only reasonnable answer is just trying and testing a maximum of different combinations of OS, screen readers, GUI toolkits and components, as much as you can. That's the only way to discover what works well for your particular scope, and what doesn't.
There is no uniformity at all between OS, screen readers and GUI toolkits, and probably no combination working everywhere in all cases.
Longer answer
This isn't a peasure to give this answer but in fact, if you want to make sure your app is 100% screen reader accessible, your only way is basicly to stop using GUI toolkits and exclusively use the native components offered by the OS for which accessibility is well documented; and therefore of course develop as many different apps as OS you intent to support.
As soon as you are using a GUI toolkit, you are adding a layer, and may lose some accessibility (and often more than less) in the process.
The gap between the features offered by the native OS components and those proposed in the toolkit is often closed by emulation, and some of the emulations aren't made accessible, or simply can't be made accessible for various (more or less excusable) reasons.
That's why some components are accessible while some others aren't; why a given component can be accessible under one OS but not at all under another; and why a component can be accessible in version N of the toolkit but not the same component in version N+1.
In short, you have understood, accessibility is extremely fragile.
Sadly, GUI toolkits rarely well document accessibility of their components under the different OS they support.
That's really a shame. It has to be addressed.
Additionally, accessibility is often presented as being expert compicated features. It shouldn't be so. It should be easy for app developers to make accessible apps.
So, wwell, since there is often no documentation about accessibility, your only way is to try and test.
That's a lot of work, and there is no alternative. Try and test. That's all.
Digging deeper
There's generally two foundamental ways to design a GUI toolkit, and depending on which has been chosen, this has a dramatic impact on natural accessibility, and what kind of accessibility the toolkit can hope to achieve.
The first way is to start from a blank page as far as the OS permits, and from there, decide literally everything: what components to provide, and how they should look and behave.
By doing so, you make sure that your app will look and behave exactly the same everywhere. An user might be surprised or confused the first time because look and behavior is often not 100% conform to OS conventions or user preferences, but in the long run, he/she will always feel at home with your app regardless of the OS used.
However, more importantly, create everything from a blank page also means that everything must be defined from scratch for accessibility. It requires of course a lot of work, whether for the GUI implementers, or the app developer. Different toolkits place the responsibility cursor at different places.
Some toolkits perform better and/or go further than others, but in general they are nowhere near what the native components of the OS can provide.
The second way is to use as much as possible the components proposed by the OS, and emulate only missing features when they are really needed.
This is excellent for accessibility, since almost all native OS components are naturally accessible or only require little effort. Users will have an app that conforms to the general look of their OS, and so won't be confused or surprised by the interface and its behavior.
However, the app isn't going to look exactly the same in all computers. Sadly, for many designers and developers, this is a definitive stopper.
As the vaste majority of GUI toolkits I know of, QT is part of the first group, but isn't playing that bad in accessibility (at least under windows) if the app developer is also aware of accessibility.
In the second group, you have WXWidgets for example.
I am going to write configuration tool for my Ubuntu based system. Next I would like to write frontends (text, GUI and web). But it is the most complicated project I wanted to write and I am not sure about general architecture I should use.
At the current I have functions and classes for changing system config. But these functions will probably grow & change. #Abki gave me advice how to write interface for frontends. I am going to make base classes for this interface but I don't know how to connect it with backend and next with frontends. Probably I should use design patterns like fasade, wrapper or something else.
It looks like (without interface_to_backend layer):
I don't care about UI and functions to change system config now. But I don't know how to write middle layer so It would be easy to connect it with the rest and extend functionality i the future.
I need general ideas, design patterns, advices how to implement this in Python.
I'm not sure this is entirely appropriate for SO but I'm intrigued and so I'll bite. As a rubyist I can't help much with the Python but here is some opinion on pattens from my experience.
My initial suggestion is you should review a few of the contenders out there. Specifically I'd be looking at cfengine, chef and bcfg2. They each tell a different story but if I'd summarise I'd say:
Chef has a lovely dsl syntax but is let down by a complicated architecture
bcfg2 is written in python but seems to have an annoying tendency to use XML :(
cfengine has the strongest theoretical underpinnings in promise theory (which is v.interesting BTW) but is C based.
Wikipedia also provides a pretty impressive list of configuration management tools that you will find useful.
In regard to designing your own tool I'd suggest there are three principles you want to pursue:
Simplicity, the simpler you make this the better. Simple in terms of scope, configuration and use are all important.
You'll need a single way to store data, you need to be able to trace the choices as they are made and not trample other people's changes (especially in a team environment).
Security, most configuration management tools need root privileges at some point. So you need to make sure that users can trust the code they're running.
You could use Fabric with Python as described in the article Ubuntu Server Setup with Python Fabric
The Wikipedia article at Comparison of open source configuration management software has several other tools that use Python to do this.
I like the approach taken by SALT.
If you write the GUI, text/CLI, and Web interfaces using Python, they can all use the same Python module. That way a change in one interface transparently affects the others. Plus all of those are in Python's area of strength.
How does the GUI testing tool PyUseCase renamed to StoryText. compare to Dogtail?
I want to hear from people who have hopefully experience in using both.
Interested in:
Maintainabilty of the testing code
How well they work against real GUI's?
Firstly: I'm the author of PyUseCase and I haven't done more than play around with Dogtail...
The tools are different in a number of respects.
Dogtail works via the accessibility interface under Gnome on Linux, while PyUseCase operates via GUI toolkits (PyGTK, Tkinter, SWT/Eclipse in the current release, plus Swing from the soon-forthcoming new release)
PyUseCase tries very hard to be usable by non-programmers. UI actions are defined in a user-defined domain language, assertions are replaced by generating and comparing plain text descriptions. It also contains a recorder.
Dogtail is a more traditional "write Python code, call APIs, assert things about what you get back" paradigm, likely a more familiar way to do things if you're used to programming and unit testing.
PyUseCase tries hard to make it very easy to change the tests en masse when the GUI changes. The testing code is super-maintainable, because there isn't any :) You get a "UI map file" instead which is just definitions.
Lastly, I'm not sure how active Dogtail is. Last time I looked it seems the last commit was in 2009, but appearances can deceive... If you want something like Dogtail, I'd suggest taking a look at the Linux Desktop Testing Project (LDTP) which is a pretty similar concept but seems a good bit more active.
PyUseCase is in any case active, to the tune of two of us working on it full time. It works pretty well on our real GUIs, but its maturity varies between the different toolkits.
I'm planning to do an Desktop application using Python, to learn some Desktop concepts. I'm going to use GTK or Qt, I still haven't decided which one.
Fact is: I would like to create an application with the possibility to be called from command line, AND using a GUI. So it would be useful for cmd fans, and GUI users as well.
It would be interesting to create a web interface too in the future, so it could be run in a server somewhere using an html interface created with a template language.
I'm thinking about two approaches:
- Creating a "model" (core module, where all the functionality resides) with a simple interface which is called from a desktop/web implementation;
- Creating a "model" with an html interface, and embeb a browser component so I could reuse all the code in both desktop/web scenarios.
My question is: which exactly concepts are involved in this project? What advantages/disadvantages each approach has? Are they possible?
By naming "interface", I'm planning to just do some interfaces.py files with def calls. Is this a bad approach?
I would like to know some book recommendations, or resources to both options - or source code from projects which share the same GUI/cmd/web goals I'm after.
Thanks in advance!
What about a link to the source?
Having a CLI command and a GUI front-end is really common on unix platforms... The TransmissionBT bit torrent client is a good example of what you plan to do.
Decoupling the presentation layer from application logic makes it possible!.
You can divide your application into layers, a layer is a reusable portion of code that performs a specific function.
For example, you can divide the application into two or more layers, one layer with the presentation of the application and the other with the model. This allows reuse of the entire model of the application with different implementations of the presentation layer.
The presentation layer contains the components that implement and display the user interface and manage user interaction. This layer includes controls for user input and display, in addition to components that organize user interaction. Can have multiple implementations of the presentation layer technologies such as PyQt4, PyGtk, Html, console, etc.
Why Separating Model Is Useful?
You may wonder why it is important to move as much logic outside the presentation layer and into the model layer. The biggest reason is reuse: logic placed in a model increases the reusability of an application. As applications grow, applications often grow into other realms. Applications may start out as a web application, but some of the functionality may later be moved to a smart client application. Portions of an application may be split between a web site and a web or windows service that runs on a server. In addition, keeping logic helps aid in developing a good design (sometimes code can get sloppier in the UI).
However, there are some caveats to this: it takes a little longer to develop applications when most of the logic resides in the business layer. The reason is this often involves creating several sets of objects (data layer and access code, plus business objects) rather than embedding it in the application. The extra time that it takes to do this can be a turnoff for some managers and project leads, especially because it often requires you to be knowledgeable about object-oriented programming, more than most people are comfortable with.
You can search about N-Layered architectural style on the Internet.
This is a sample application that implements several types of user interfaces, but based on. NET framework, for python is similar.
http://microsoftnlayerapp.codeplex.com/
I am working on a big project based on PyQt4 presentation framework. one of the styles of architecture applied is N-Layers. If you want a simple example based on PyQt4, send me a email.
I have some knowledge about Human computer interaction and some basic knowledge programming scripts (Python) that run from start to finish and automate some tasks I want to do or calculations. In the past I built interfaces in HTML with PHP behind it.
I would like my python scripts to evolve from the command line and build some applications with GUIs that would allow the user to drag files and push buttons to initiate operations and check progress graphically.
Since I write my scripts in Python I looked at some of the options (Tkinter, wxPython, PyQt) but I can't make a decision between them to invest my time learn one and not the other. My criteria:
Has a introduction for programmers for GUI (what are the differences from a script, examples of some simple interfaces)
A framework that would allow me to run my programs on the platforms I use most (Windows) but that can also run on Mac and maybe Linux, without too much modification.
Very shallow learning curve (easy to make first interfaces) but flexibility later on to customize the interface beyond what the typical OS allows (different colors, size and shapes of buttons, for example)
If not the same, similar to how you program GUI for Android and/or Nokia smartphones. I'm planning to write some programs for these platforms in the near future so I would like to carry over some of the lessons here onto those platforms, if possible.
I did find this previous question but none of the answers are satisfactory.
Does any of the frameworks fit these requirements better than the others or are they essentially similar and I would be happy with any of them?
Note: If you think I should consider other language rather than Python to achieve this, which one? I really like Python whitespace syntax and have grown used to it so I would prefer to stick with it.
PyQt and/or the very similar Nokia-sponsored PySide (with a more "relaxed" license, LGPL instead of GPL, and the same underlying toolkit, Qt) do offer the advantage of similarity with Nokia's smartphones GUI toolkit (your fourth point) -- Nokia purchased Trolltech, the makers of Qt, exactly because Qt was the fundamental GUI toolkit for their mobile offerings.
All the toolkits you mention satisfy the conditions you pose about operating systems (Windows, Mac, Linux), your second point.
Your first and to some extend third points depend in good part of what learning materials you have available for each of the toolkits. To my tastes, it seems that wxPython's tutorial (the new one in wiki form is what I'm pointing to and recommending) is really good, and PyQt's not bad at all; PySide's docs don't include a good tutorial (that I know of), I believe PySide's intention is that you first learn PyQt (with the reasonable available materials), then apply these few differences to be programming in PySide instead of PyQt;-). Tkinter's tutorials that I can find are either very old or focused on the underlying toolkit's multi-language nature, which I think makes them inferior.
If you can afford a book, PyQt has a good one (also applies to PySide, as above) -- this excellent and free one is unfortunately very old, so I don't think it helps. wxPython's own book is also quite good; tkinter's, again, is very dated.
Personally I recommend PyQt / PySide: overall power A+, ease to get started (with the above tutorial and book) A-, Nokia-phone programmer similarity A. For wxPython I'd say power A, ease A, Nokia-similarity B. Tkinter's dated tutorials and book are important negatives.
You also mention Android, but I don't see how anything could be similar to both Android and Nokia's phone-GUI programming at the same time. Maybe I'm not familiar enough with Android GUI programming, but it seems to me that it differs from every one of the toolkits you've mentioned.
PyGTK fufills at least the first three points. I'm not sure on the fourth. It has a nice tutorial here: http://www.pygtk.org/pygtk2tutorial/index.html
I guess you are looking for Glade.
The site says:
Glade is a RAD tool to enable quick & easy development of user
interfaces for the GTK+ toolkit and the GNOME desktop environment.
The user interfaces designed in Glade are saved as XML, and by using
the GtkBuilder GTK+ object these can be loaded by applications
dynamically as needed.
By using GtkBuilder, Glade XML files can be used in numerous
programming languages including C, C++, C#, Vala, Java, Perl,
Python,and others.
I am a pretty noob programmer yet, but I am having just a few issues to get things started with C and Glade. So I guess you will run smoothly here with your snake. Take a look.