"""pyRadKDE - a wheel type command interface for KDE, inspired by Kommando (KDE 3) and Neverwinternights.
+# additional documentation - gets added to the docstring by hand, so I can more easily use it in user output
- Add a mouse gesture for "pyrad.py": go into KDE systemsettings -> keyboard shortcuts -> add a gesture with the action "pyrad.py" (you might have to enable gestures in the settings, too - in the shortcuts-window you should find a settings button).
-- customize the menu by editing the file "~/.pyradrc" or right-clicking items.
+- customize the menu by editing the file "~/.pyradrc" or right-clicking items.
- Just use your gesture to call up the command wheel when you want to call one of your included programs.
-- Right-click an item to edit it. Right-click the center to add a new item.
-- Make folders by using the action [("kreversi", None), ("icon", "action"), ("icon2", "action2"), ...]
-- Actions are simply the commands you'd use on the commandline.
+- Right-click an item to edit it. Middle-click an item to add a new one after it (clockwise).
+- Make folders by using the action [("kreversi", None), ("icon", "action"), ("icon2", "action2"), ...].
+ Actions are simply the commands you'd use on the commandline.
+- call "pyrad.py --quit" to shutdown the process in the background. "pyrad.py --help" shows the usage.
- new command scheme: right-click always edits, middle-click adds a new item. -done
- first run of new version shows image as usage guide. -todo
- register a global shortcut / gesture in KDE from within the program -> usable as soon as it's installed. -todo
- make it show faster. -todo
- adjust icon size to the numbers of icons in the circle.
PyPI url: http://pypi.python.org/pypi/pyRadKDE
+__doc__ += __install__ + __usage__ + __plans__ + __ideas__
along with this program. If not, see <http://www.gnu.org/licenses/>
+#: The PyRad version identifier
+### Commandline handling ###
+# we do this here to have the maximum reaction time.
# First the GUI class and the Data about the program
-#from rad import aboutData
-# Also SIGNAL and SLOT, so we doon't call PyQt4 directly from here.
-from rad import SIGNAL, SLOT
+# we use an import function, so we can easily delay the import.
+ """Import the Rad GUI."""
# Then commandline arguments and handling
-from PyKDE4.kdecore import KCmdLineArgs
+from PyKDE4.kdecore import KCmdLineArgs, KCmdLineOptions
# And AboutData - moved here, so we don't need to pull in GUI stuff to check if we're the first instance
from PyKDE4.kdecore import ki18n, KAboutData
# KApplication for basics
from PyKDE4.kdeui import KUniqueApplication
from sys import exit as exit_
+### C ###
-#: The PyRad version identifier
+ def __init__(self, *args, **kwds):
+ """Initialize the App and import all GUI elements.
+ This gets only called when there's no already existing instance of the app."""
+ super(KUniqueCaller, self).__init__(*args, **kwds)
+ # And get and show the GUI
+ """Get a new instance -> in reality only check if there's already an instance and tell the GUI to run."""
+ # if we get the quit arg ("pyrad.py --quit"), we close and shutdown
+ args = KCmdLineArgs.parsedArgs()
+ ret = super(KUniqueCaller, self).newInstance()
aboutData = createAboutData()
# Now we need to compile the commandline args for KDE programs
KCmdLineArgs.init (argv, aboutData)
+ # Add an option to quit the app
+ opts = KCmdLineOptions()
+ opts.add("quit", ki18n("Shutdown the background program"))
# Then do basic initializing
- app = KUnique
# And get and show the GUI
# Then do basic initializing
- # And get and show the GUI
# Finally we execute the program - and return the exit code from the program.