diff options
Diffstat (limited to 'python/pykde/templates')
18 files changed, 0 insertions, 2031 deletions
diff --git a/python/pykde/templates/annotated/basicapp.py b/python/pykde/templates/annotated/basicapp.py deleted file mode 100644 index 04300b48..00000000 --- a/python/pykde/templates/annotated/basicapp.py +++ /dev/null @@ -1,113 +0,0 @@ -""" -This is a minimal PyKDE app template - it constructs an application -and a main window, but does nothing else. -""" - -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - - -import sys - -from kdecore import KApplication, KCmdLineArgs, KAboutData -from kdeui import KMainWindow - -""" -Most PyKDE applications will need a main window - the is the top -level widget (the parent for all other widgets). KMainWindow has -more functionality than shown here (see more complex templates). -It has the ability to create the other major parts of the user -interface - the main view, menus, toolbars, etc. - -Usually you provide a subclass of KMainWindow, construct menus -and toolbars in the subclass' __init__ method, and provide -slots for menu/toolbar actions in separate methods. -""" - -class MainWin (KMainWindow): - def __init__ (self, *args): - apply (KMainWindow.__init__, (self,) + args) - - -#-------------------- main ------------------------------------------------ - -# set up some basic information about the program in -# a KAboutData object - this affects the application's -# title bar caption and makes it easy to set up a -# Help | About dialog box for your app -appName = "some app" -programName = "some program" -description = "A basic application template" -license = KAboutData.License_GPL -version = "1.0" -copyright = "(C) 2003 whoever the author is" - -aboutData = KAboutData (appName, programName, version, description, license, copyright) - -# you can add the names of the app's authors here -aboutData.addAuthor ("author1", "whatever they did", "email@somedomain") -aboutData.addAuthor ("author2", "they did something else", "another@email.address") - -# Pass the command line arguments and aboutData to -# KCmdLineArgs - this is where KDE will look for -# this information. The KApplication constructor -# used below *requires* the args are processed -# *before* KApplication is instantiated. There -# is an alternate constructor that takes sys.argv -# as an argument (see minimal.py) - -# Note that instead of argc/argv, this constructor -# only takes a single argument - sys.argv - which -# is a Python list -KCmdLineArgs.init (sys.argv, aboutData) - -# Set up the command line options (switches) you -# want your app to be able to process (you could -# use Python's getopt module instead, but it works -# a little differently) - -# Note that the argument for this method is a list -# of tuples -KCmdLineArgs.addCmdLineOptions ([("+files", "File to open")]) - -# instantiate KApplication - no other QObject -# or QWidget based classes can be instantiated -# until there is a KApplication instance -app = KApplication () - -# instantiate the subclass of KMainWindow -mainWindow = MainWin (None, "main window") - -# create the display -mainWindow.show() - -# run KApplication's event loop until the -# program exits -app.exec_loop() - diff --git a/python/pykde/templates/annotated/menuapp1.py b/python/pykde/templates/annotated/menuapp1.py deleted file mode 100644 index 8a634bf1..00000000 --- a/python/pykde/templates/annotated/menuapp1.py +++ /dev/null @@ -1,270 +0,0 @@ -""" -This template constructs an application with menus, toolbar and statusbar, -HOWEVER it is not recommended this template actually be used. It presents -the "KDE 1.0" method for constructing menus and toolbars - later versions -of KDE have introduced better (easier and more powerful) methods for -doing this job - see other menuapp*.py templates for these methods -""" - - -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - - -False = 0 -True = not False - - -import sys - -from qt import QPopupMenu, SIGNAL - -from kdecore import KApplication, KCmdLineArgs, KAboutData, i18n, KStdAccel, KIcon, KIconLoader -from kdeui import KMainWindow, KMessageBox - -TOOLBAR_NEW = 1 -TOOLBAR_OPEN = 2 -TOOLBAR_SAVE = 3 -TOOLBAR_CUT = 4 -TOOLBAR_COPY = 5 -TOOLBAR_PASTE = 6 - -STATUSBAR_LEFT = 1 -STATUSBAR_MIDDLE = 2 -STATUSBAR_RIGHT = 3 - -class MainWin (KMainWindow): - def __init__ (self, *args): - apply (KMainWindow.__init__, (self,) + args) - - self.initMenus () - self.initToolBar () - self.initStatusBar () - - def initMenus (self): - # Create a QPopupMenu - all menus are "popup" menus - - fileMenu = QPopupMenu (self) - - # This is the "simple" KDE-1.0 way. It is not suggested that this - # template actually be used in an application, but it's - # provided to show the underlying mechanics of menu construction - # that KDE makes much easier with other methods (see other - # menuapp*.py templates for usable examples) - - # All menu item strings are wrapped with i18n - this allows - # internationalization - - # Predefined accelerators are in KStdAccel - these are - # the standard accelerators. For custom accelerators, use - # KAccel. All KStdAccel methods are static, so there is no - # need to instantiate KStdAccel - - # "File" menu items - fileMenu.insertItem (i18n ("New"), self.slotNew, KStdAccel.openNew ()) - fileMenu.insertItem (i18n ("Open"), self.slotOpen, KStdAccel.open ()) - fileMenu.insertSeparator (); - fileMenu.insertItem (i18n ("Save"), self.slotSave, KStdAccel.save ()) - - # KStdAccel doesn't have a standard accelerator for 'Save As', - # so we omit it - insertItem uses the default value - - fileMenu.insertItem (i18n ("SaveAs"), self.slotSaveAs) - - # This inserts a line between groups of items in a menu - - fileMenu.insertSeparator (); - - # Note the "KStdAccel.print_" has a trailing underscore, unlike the - # equivalent KDE method - the underscore is necessary to prevent a - # clash with the Python keyword 'print' - - fileMenu.insertItem (i18n ("Print"), self.slotPrint, KStdAccel.print_ ()) - - fileMenu.insertSeparator (); - fileMenu.insertItem (i18n ("&Quit"), self.slotQuit, KStdAccel.quit ()); - - # Put fileMenu (as the File menu) into the menu bar - # 'menuBar' is a predefined object owned by KMainWindow - - self.menuBar ().insertItem (i18n ("&File"), fileMenu) - - - editMenu = QPopupMenu (self) - - # "Edit" menu items - editMenu.insertItem (i18n ("Undo"), self.slotUndo, KStdAccel.undo ()) - editMenu.insertItem (i18n ("Redo"), self.slotRedo, KStdAccel.redo ()) - editMenu.insertSeparator (); - editMenu.insertItem (i18n ("Cut"), self.slotCut, KStdAccel.cut ()) - editMenu.insertItem (i18n ("Copy"), self.slotCopy, KStdAccel.copy ()) - editMenu.insertItem (i18n ("Paste"), self.slotPaste, KStdAccel.paste ()) - editMenu.insertSeparator (); - editMenu.insertItem (i18n ("Find"), self.slotFind, KStdAccel.find ()) - editMenu.insertItem (i18n ("Find Next"), self.slotFindNext, KStdAccel.findNext ()) - editMenu.insertItem (i18n ("Replace"), self.slotReplace, KStdAccel.replace ()) - - # Put editMenu (as the Edit menu) into the menu bar - - self.menuBar ().insertItem (i18n ("&Edit"), editMenu) - - # Let KDE generate a nifty help menu - - # The KAboutData/KCmdLineArgs data from the main part of the program - # will be used to generate the About dialog - - helpMenu = self.helpMenu ("") - self.menuBar ().insertItem (i18n ("&Help"), helpMenu) - - def initToolBar (self): - # KIconLoader will make it easy to locate the standard KDE icons for - # toolbar buttons. For custom icons, a complete path to the icon - # (without the loadIcon call) is needed - icons = KIconLoader () - - # KMainWindow owns at least one KToolBar instance, which is returned - # by 'self.toolBar ()'. To obtain additional toolbars, add an argument - # to the call -- self.toolBar (1) will return another toolbar you can - # add buttons to. - - # Add buttons to the toolbar. The icon name, id value (eg TOOLBAR_NEW), - # signal to connect (eg clicked) and the slot to connect to all need - # to be specified,as does the tooltip (the last string argument). There - # are easier ways to do this - see other menuapp templates for easier - # methods using KAction/KStdAction - - self.toolBar ().insertButton (icons.loadIcon ("filenew", KIcon.Toolbar), TOOLBAR_NEW, SIGNAL ("clicked (int)"), self.slotNew,\ - True, "New") - self.toolBar ().insertButton (icons.loadIcon ("fileopen", KIcon.Toolbar), TOOLBAR_OPEN, SIGNAL ("clicked (int)"), self.slotOpen,\ - True, "Open") - self.toolBar ().insertButton (icons.loadIcon ("filesave", KIcon.Toolbar), TOOLBAR_SAVE, SIGNAL ("clicked (int)"), self.slotSave,\ - True, "Save") - self.toolBar ().insertButton (icons.loadIcon ("editcut", KIcon.Toolbar), TOOLBAR_CUT, SIGNAL ("clicked (int)"), self.slotCut,\ - True, "Cut") - self.toolBar ().insertButton (icons.loadIcon ("editcopy", KIcon.Toolbar), TOOLBAR_COPY, SIGNAL ("clicked (int)"), self.slotCopy,\ - True, "Copy") - self.toolBar ().insertButton (icons.loadIcon ("editpaste", KIcon.Toolbar), TOOLBAR_PASTE, SIGNAL ("clicked (int)"), self.slotPaste,\ - True, "Paste") - - def initStatusBar (self): - # KMainWindow also owns a KStatusBar instance. The first - # call creates a KStatusBar instance. See 'notImpl' below - # for an example of writing to the status bar. You can - # also add widgets (labels, progress bars, etc) to the - # status bar - - self.statusBar ().insertItem ("", STATUSBAR_LEFT, 1000, True) - self.statusBar ().insertItem ("", STATUSBAR_MIDDLE, 1000, True) - self.statusBar ().insertItem ("", STATUSBAR_RIGHT, 1000, True) - - -#-------------------- slots ----------------------------------------------- - - # Slots which can be called from both the menu toolbar - # have a second parameter with a default value (id = -1) - # This is because menu signals expect to connect to a - # slot that takes no arguments, while toolbar signals - # expect to send a signal with an int argument for the - # id of the toolbar button. The default value allows - # both cases to work. - - def slotNew (self, id = -1): - self.notImpl ("New") - - def slotOpen(self, id = -1): - self.notImpl ("Open") - - def slotSave (self, id = -1): - self.notImpl ("Save") - - def slotSaveAs (self): - self.notImpl ("Save As") - - def slotPrint (self): - self.notImpl ("Print") - - def slotQuit (self): - self.notImpl ("Quit") - - def slotUndo (self): - self.notImpl ("Undo") - - def slotRedo (self): - self.notImpl ("Redo") - - def slotCut (self, id = -1): - self.notImpl ("Cut") - - def slotCopy (self, id = -1): - self.notImpl ("Copy") - - def slotPaste (self, id = -1): - self.notImpl ("Paste") - - def slotFind (self): - self.notImpl ("Find") - - def slotFindNext (self): - self.notImpl ("Find Next") - - def slotReplace (self): - self.notImpl ("Replace") - - def notImpl (self, item = "Feature"): - self.statusBar ().changeItem ("%s not implemented" % item, STATUSBAR_LEFT) - KMessageBox.error (self, "%s not implemented" % item, "Not Implemented") - self.statusBar ().changeItem ("", STATUSBAR_LEFT) - - -#-------------------- main ------------------------------------------------ - -# See athe minimal.py and basicapp.py templates for -# explantion of the basic app and main window setup - -# The following data is passed to KCmdLineArgs, which in -# turn makes it available to the "about" box in the Help -# menu (when the Help menu is created as above) - -description = "A basic application template" -version = "1.0" -aboutData = KAboutData ("", "",\ - version, description, KAboutData.License_GPL,\ - "(C) 2003 whoever the author is") - -aboutData.addAuthor ("author1", "whatever they did", "email@somedomain") -aboutData.addAuthor ("author2", "they did something else", "another@email.address") - -KCmdLineArgs.init (sys.argv, aboutData) - -KCmdLineArgs.addCmdLineOptions ([("+files", "File to open")]) - -app = KApplication () -mainWindow = MainWin (None, "main window") -mainWindow.show() -app.exec_loop() diff --git a/python/pykde/templates/annotated/menuapp2.py b/python/pykde/templates/annotated/menuapp2.py deleted file mode 100644 index 07523b86..00000000 --- a/python/pykde/templates/annotated/menuapp2.py +++ /dev/null @@ -1,244 +0,0 @@ -""" -This template constructs an application with menus, toolbar and statusbar. -It uses KDE classes and methods that simplify the task of building and -operating a GUI. It is recommended that this approach be used, rather -than the primitive approach in menuapp1.py -""" - -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - - -False = 0 -True = not False - - -import sys - -from qt import QPopupMenu, SIGNAL - -from kdecore import KApplication, KCmdLineArgs, KAboutData, i18n -from kdeui import KMainWindow, KMessageBox, KStdAction, KAction - -STATUSBAR_LEFT = 1 -STATUSBAR_MIDDLE = 2 -STATUSBAR_RIGHT = 3 - -class MainWin (KMainWindow): - def __init__ (self, *args): - apply (KMainWindow.__init__, (self,) + args) - - # Create the actions that will populate - # the menus and toolbars - self.initActions () - - # Plug actions into menus - self.initMenus () - - # Plug actions into toolbars - self.initToolBar () - - # Create the status bar - self.initStatusBar () - - # Usings actions, only a single line is required - # to enable/disable both the menu item and corresponding - # toolbar button from anywhere in the program - self.saveAction.setEnabled (False) - self.saveAsAction.setEnabled (False) - - def initActions (self): - # Most of the functions selectable by menu are "standard" - # actions (open a file, cut, paste, etc) - you customize - # how they behave in your code, but menu, toolbar, and - # accelerator settings are the same across all programs. - # Standard actions also have tooltips already assigned - - # To create most of the actions below, KStdAction is - # is used, since it takes care of everything with - # a single line of code. - - # The standard actions only need to specify the slot - # where the code for the action is located - - # "File" menu items - self.newAction = KStdAction.openNew (self.slotNew) - self.openAction = KStdAction.open (self.slotOpen) - self.saveAction = KStdAction.save (self.slotSave) - self.saveAsAction = KStdAction.saveAs (self.slotSaveAs) - self.printAction = KStdAction.print_ (self.slotPrint) - self.quitAction = KStdAction.quit (self.slotQuit) - - # "Edit" menu items - self.undoAction = KStdAction.undo (self.slotUndo) - self.redoAction = KStdAction.redo (self.slotRedo) - self.cutAction = KStdAction.cut (self.slotCut) - self.copyAction = KStdAction.copy (self.slotCopy) - self.pasteAction = KStdAction.paste (self.slotPaste) - self.findAction = KStdAction.find (self.slotFind) - self.findNextAction = KStdAction.findNext (self.slotFindNext) - self.replaceAction = KStdAction.replace (self.slotReplace) - - # For actions that are not "standard", you can create your - # own actions using KAction. This example doesn't include - # an icon, but there is a KAction constructor that will - # allow you to specify an icon (for toolbar use, for instance), - # or you can use KAction.setIcon to set/change the icon. You - # can also add a tooltip with KAction.setToolTip - - # This KAction constructor requires a QString, an accelerator (0 - # in this case), a slot, and a QObject (None in this case) - - self.specialAction = KAction (i18n ("Special"), 0, self.slotSpecial, None) - - def initMenus (self): - # plug the actions into the menus - - fileMenu = QPopupMenu (self) - self.newAction.plug (fileMenu) - self.openAction.plug (fileMenu) - fileMenu.insertSeparator () - self.saveAction.plug (fileMenu) - self.saveAsAction.plug (fileMenu) - fileMenu.insertSeparator () - self.printAction.plug (fileMenu) - fileMenu.insertSeparator () - self.quitAction.plug (fileMenu) - self.menuBar ().insertItem (i18n ("&File"), fileMenu) - - editMenu = QPopupMenu (self) - self.undoAction.plug (editMenu) - self.redoAction.plug (editMenu) - editMenu.insertSeparator () - self.cutAction.plug (editMenu) - self.copyAction.plug (editMenu) - self.pasteAction.plug (editMenu) - editMenu.insertSeparator () - self.findAction.plug (editMenu) - self.findNextAction.plug (editMenu) - self.replaceAction.plug (editMenu) - editMenu.insertSeparator () - self.specialAction.plug (editMenu) - self.menuBar ().insertItem (i18n ("&Edit"), editMenu) - - # Uses the info from KAboutData (specified below) - # to construct the "About" box in the Help menu - - helpMenu = self.helpMenu ("") - self.menuBar ().insertItem (i18n ("&Help"), helpMenu) - - def initToolBar (self): - # Add some (but not all) actions to the toolbar - - self.newAction.plug (self.toolBar ()) - self.openAction.plug (self.toolBar ()) - self.saveAction.plug (self.toolBar ()) - self.cutAction.plug (self.toolBar ()) - self.copyAction.plug (self.toolBar ()) - self.pasteAction.plug (self.toolBar ()) - - def initStatusBar (self): - # Initialize the status bar - - self.statusBar ().insertItem ("", STATUSBAR_LEFT, 1000, True) - self.statusBar ().insertItem ("", STATUSBAR_MIDDLE, 1000, True) - self.statusBar ().insertItem ("", STATUSBAR_RIGHT, 1000, True) - -#-------------------- slots ----------------------------------------------- - - def slotNew (self, id = -1): - self.notImpl ("New") - - def slotOpen(self, id = -1): - self.notImpl ("Open") - - def slotSave (self, id = -1): - self.notImpl ("Save") - - def slotSaveAs (self): - self.notImpl ("Save As") - - def slotPrint (self): - self.notImpl ("Print") - - def slotQuit (self): - self.notImpl ("Quit") - - def slotUndo (self): - self.notImpl ("Undo") - - def slotRedo (self): - self.notImpl ("Redo") - - def slotCut (self, id = -1): - self.notImpl ("Cut") - - def slotCopy (self, id = -1): - self.notImpl ("Copy") - - def slotPaste (self, id = -1): - self.notImpl ("Paste") - - def slotFind (self): - self.notImpl ("Find") - - def slotFindNext (self): - self.notImpl ("Find Next") - - def slotReplace (self): - self.notImpl ("Replace") - - def slotSpecial (self): - self.notImpl ("Special") - - def notImpl (self, item = "Feature"): - self.statusBar ().changeItem ("%s not implemented" % item, STATUSBAR_LEFT) - KMessageBox.error (self, "%s not implemented" % item, "Not Implemented") - self.statusBar ().changeItem ("", STATUSBAR_LEFT) - - -#-------------------- main ------------------------------------------------ - -description = "A basic application template" -version = "1.0" -aboutData = KAboutData ("", "",\ - version, description, KAboutData.License_GPL,\ - "(C) 2003 whoever the author is") - -aboutData.addAuthor ("author1", "whatever they did", "email@somedomain") -aboutData.addAuthor ("author2", "they did something else", "another@email.address") - -KCmdLineArgs.init (sys.argv, aboutData) - -KCmdLineArgs.addCmdLineOptions ([("+files", "File to open")]) - -app = KApplication () -mainWindow = MainWin (None, "main window") -mainWindow.show() -app.exec_loop() diff --git a/python/pykde/templates/annotated/menuapp3.py b/python/pykde/templates/annotated/menuapp3.py deleted file mode 100644 index 1935ce59..00000000 --- a/python/pykde/templates/annotated/menuapp3.py +++ /dev/null @@ -1,209 +0,0 @@ -""" -This template constructs an application with menus, toolbar and statusbar. -It uses an XML file (menuapp3ui.rc) to specify the menu layout; all menu -items have a corresponding action defined, but no menus are created -explicitly in code. This app has the same menu layout as menuapp2.py -""" - -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - - -False = 0 -True = not False - - -import sys - -from qt import QPopupMenu, SIGNAL - -from kdecore import KApplication, KCmdLineArgs, KAboutData, i18n -from kdeui import KMainWindow, KMessageBox, KStdAction, KAction, KActionCollection - -STATUSBAR_LEFT = 1 -STATUSBAR_MIDDLE = 2 -STATUSBAR_RIGHT = 3 - -class MainWin (KMainWindow): - def __init__ (self, *args): - apply (KMainWindow.__init__, (self,) + args) - - # Create actions that correspond to those in the XML file - self.initActions () - - # Parse the default XML file (<appName>ui.rc> and create - # the menus and toolbar. This single line (and the XML - # file it reads) replace initMenus and initToolBar from - # menuapp2.py. Otherwise, the menuapp2 and menuapp3 - # are identical 'createGUI' expects to find 'menuapp3ui.rc' - # either in the directory menuapp3.py is run from, or - # in $KDEDIR/apps/menuapp3/ - self.createGUI () - - # Create the status bar - self.initStatusBar () - - # Disable a couple of menu items using their actions - self.saveAction.setEnabled (False) - self.saveAsAction.setEnabled (False) - - def initActions (self): - # Most of the functions selectable by menu are "standard" - # actions (open a file, cut, paste, etc) - you customize - # how they behave in your code, but menu, toolbar, and - # accelerator settings are the same across all programs. - # Standard actions also have tooltips already assigned - - # To create most of the actions below, KStdAction is - # is used, since it takes care of everything with - # a single line of code. - - # The standard actions only need to specify the slot - # where the code for the action is located - - # Because the XMLGUI mechanism parses $KDEDIR/config/ui/ui_standards.rc - # before parsing and merging menuapp3ui.rc, it actually isn't - # necessary to list KStdAction actions in menuapp3.rc. THE XMLGUI - # code will create menu/toolbar items and place them *automatically* - # if you defined the KStdActions as below. In fact, you can't override - # this behavior using KStdActions - if you want menus to be "non-standard" - # KDE menus (eg 'Cut' in the 'File' menu), you'll need to create your - # actions from KAction instead of KStdAction. Obviously it makes more - # sense to use the mechanism provided to produce consistent menus and - # toolbars. You can "unplug" items if, for example, you don't want them - # in the toolBar. - - # "File" menu items - self.newAction = KStdAction.openNew (self.slotNew, self.actionCollection ()) - self.openAction = KStdAction.open (self.slotOpen, self.actionCollection ()) - self.saveAction = KStdAction.save (self.slotSave, self.actionCollection ()) - self.saveAsAction = KStdAction.saveAs (self.slotSaveAs, self.actionCollection ()) - self.printAction = KStdAction.print_ (self.slotPrint, self.actionCollection ()) - self.quitAction = KStdAction.quit (self.slotQuit, self.actionCollection ()) - - - # "Edit" menu items - self.undoAction = KStdAction.undo (self.slotUndo, self.actionCollection ()) - self.redoAction = KStdAction.redo (self.slotRedo, self.actionCollection ()) - self.cutAction = KStdAction.cut (self.slotCut, self.actionCollection ()) - self.copyAction = KStdAction.copy (self.slotCopy, self.actionCollection ()) - self.pasteAction = KStdAction.paste (self.slotPaste, self.actionCollection ()) - self.findAction = KStdAction.find (self.slotFind, self.actionCollection ()) - self.findNextAction = KStdAction.findNext (self.slotFindNext, self.actionCollection ()) - self.replaceAction = KStdAction.replace (self.slotReplace, self.actionCollection ()) - - # For ANYTHING constructed from KAction or its descendants (KActionMenu, KActionSeparator, - # KFontAction, etc) you MUST provide the self.actionCollection () parent and an object - # name ("specialActionName") or the XMLGUI mechanism will not be able to locate the - # action. XMLGUI finds the action via its member name value, NOT via its variable name. - self.specialAction = KAction (i18n ("Special"), 0, self.slotSpecial, self.actionCollection (), "specialActionName") - - def initStatusBar (self): - self.statusBar ().insertItem ("", STATUSBAR_LEFT, 1000, True) - self.statusBar ().insertItem ("", STATUSBAR_MIDDLE, 1000, True) - self.statusBar ().insertItem ("", STATUSBAR_RIGHT, 1000, True) - -#-------------------- slots ----------------------------------------------- - - def slotNew (self, id = -1): - self.notImpl ("New") - - def slotOpen(self, id = -1): - self.notImpl ("Open") - - def slotSave (self, id = -1): - self.notImpl ("Save") - - def slotSaveAs (self): - self.notImpl ("Save As") - - def slotPrint (self): - self.notImpl ("Print") - - def slotQuit (self): - self.notImpl ("Quit") - - def slotUndo (self): - self.notImpl ("Undo") - - def slotRedo (self): - self.notImpl ("Redo") - - def slotCut (self, id = -1): - self.notImpl ("Cut") - - def slotCopy (self, id = -1): - self.notImpl ("Copy") - - def slotPaste (self, id = -1): - self.notImpl ("Paste") - - def slotFind (self): - self.notImpl ("Find") - - def slotFindNext (self): - self.notImpl ("Find Next") - - def slotReplace (self): - self.notImpl ("Replace") - - def slotSpecial (self): - self.notImpl ("Special") - - def notImpl (self, item = "Feature"): - self.statusBar ().changeItem ("%s not implemented" % item, STATUSBAR_LEFT) - KMessageBox.error (self, "%s not implemented" % item, "Not Implemented") - self.statusBar ().changeItem ("", STATUSBAR_LEFT) - - -#-------------------- main ------------------------------------------------ - -description = "A basic application template" -version = "1.0" - -# To use the XMLGUI mechanism, you MUST provide an appName -# (the first argument to KAboutData below) - the XML spec -# for the interface will be in <appName>ui.rc (don't forget -# the "ui" suffix to the application name) -aboutData = KAboutData ("menuapp3", "",\ - version, description, KAboutData.License_GPL,\ - "(C) 2003 whoever the author is") - -aboutData.addAuthor ("author1", "whatever they did", "email@somedomain") -aboutData.addAuthor ("author2", "they did something else", "another@email.address") - -KCmdLineArgs.init (sys.argv, aboutData) - -KCmdLineArgs.addCmdLineOptions ([("+files", "File to open")]) - -app = KApplication () -mainWindow = MainWin (None, "main window") -mainWindow.show() -app.exec_loop() - diff --git a/python/pykde/templates/annotated/menuapp3ui.rc b/python/pykde/templates/annotated/menuapp3ui.rc deleted file mode 100644 index 60120e21..00000000 --- a/python/pykde/templates/annotated/menuapp3ui.rc +++ /dev/null @@ -1,24 +0,0 @@ -<!DOCTYPE kpartgui> -<kpartgui name = "menuapp3"> -<MenuBar> - <Menu name="file"><text>&File</text> - <Action name ="newAction"/> - <Action name ="openAction"/> - <Action name ="saveAction"/> - <Action name ="saveAsAction"/> - <Action name ="printAction"/> - <Action name ="quitAction"/> - </Menu> - <Menu name = "edit"><text>&Edit</text> - <Action name ="undoAction"/> - <Action name ="redoAction"/> - <Action name ="cutAction"/> - <Action name ="copyAction"/> - <Action name ="pasteAction"/> - <Action name ="findAction"/> - <Action name ="findNextAction"/> - <Action name ="replaceAction"/> - <Action name ="specialActionName"/> - </Menu> -</MenuBar> -</kpartgui>
\ No newline at end of file diff --git a/python/pykde/templates/annotated/minimal.py b/python/pykde/templates/annotated/minimal.py deleted file mode 100644 index a3e87c8a..00000000 --- a/python/pykde/templates/annotated/minimal.py +++ /dev/null @@ -1,75 +0,0 @@ -""" -This is a minimal PyKDE app template - it constructs an application -and a main window, but does nothing else. -""" - -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - -import sys - -from kdecore import KApplication -from kdeui import KMainWindow - - -""" -Most PyKDE applications will need a main window - the is the top -level widget (the parent for all other widgets). KMainWindow has -more functionality than shown here (see more complex templates). -It has the ability to create the other major parts of the user -interface - the main view, menus, toolbars, etc. - -Usually you provide a subclass of KMainWindow, construct menus -and toolbars in the subclass' __init__ method, and provide -slots for menu/toolbar actions in separate methods. -""" -class MainWin (KMainWindow): - def __init__ (self, *args): - apply (KMainWindow.__init__, (self,) + args) - - -#-------------------- main ------------------------------------------------ - -# instantiate KApplication - no other QObject -# or QWidget based classes can be instantiated -# until there is a KApplication instance -appName = "template" -app = KApplication (sys.argv, appName) - -# instantiate the subclass of KMainWindow -mainWindow = MainWin (None, "main window") - -# create the display -mainWindow.show() - -# run KApplication's event loop until the -# program exits -app.exec_loop() - - diff --git a/python/pykde/templates/annotated/panelapplet.py b/python/pykde/templates/annotated/panelapplet.py deleted file mode 100644 index 009ee56b..00000000 --- a/python/pykde/templates/annotated/panelapplet.py +++ /dev/null @@ -1,64 +0,0 @@ -""" -A basic panel applet template - working examples are in the -pykpanelapplet/ directory -""" -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - -from kdeui import PyKPanelApplet, KPanelApplet - - -# Any panel applet written in Python must include THIS "factory" function -# The name must be createApplet, and it must take the two args shown; it -# must return a PyKPanelApplet subclass - -# Change "PanelAppletName" to something meaningful here and in the class -# declaration -def createApplet (parent, configFile): - return PanelAppletName (configFile, KPanelApplet.Normal, 0, parent, "nameMe") - - -# Define the PyKPanelApplet subclass in a fashion similar to this -# (PyKPanelApplet is a subclass of KPanelApplet, and exposes all of -# KPanelApplet's methods) - -# You can change the arg list for __init__ as needed (and make the corresponding -# change in the call in createApplet), as long as you have the basic info -# needed to call PyKPanelApplet.__init__ -class PanelAppletName (PyKPanelApplet): - def __init__ (self, configFile, t, actions, parent, name, f = 0): - PyKPanelApplet.__init__ (self, configFile, t, actions, parent, name, f) - -# Change these methods to have kicker size your applet appropriately -# As written, they provide a square applet window - def widthForHeight (self, h): - return h - - def heightForWidth (self, w ): - return w diff --git a/python/pykde/templates/annotated/systray.py b/python/pykde/templates/annotated/systray.py deleted file mode 100644 index 41dc62a2..00000000 --- a/python/pykde/templates/annotated/systray.py +++ /dev/null @@ -1,82 +0,0 @@ -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - -import sys - -from qt import QWidget, SIGNAL -from kdecore import KApplication, KIcon, KIconLoader -from kdeui import KSystemTray - -""" -Typically an application's "main window" will be a KMainWindow or -a subclass of KMainWindow (KMainWindow provides simple mechanisms -for constructing mens, toolbars, statusbars, etc). The problem with -using KMainWindow in a System Tray application is that when -KMainWindow is closed, it also shuts down KApplication and the -program terminates. - -One way around that (not necessarily the best way - see systray1.py) -is to make the "main window" a QWidget or other QWidget subclass -that's not KMainWindow. -""" - -class MainWin (QWidget): - def __init__ (self, *args): - apply (QWidget.__init__, (self,) + args) - -#-------------------- main ------------------------------------------------ - -# This slot receives the "quitSelected ()" signal that's emitted -# when the user right clicks the icon in the system tray and -# selects "Quit" from the popup menu -def slotQuitSelected (): - KApplication.kApplication ().quit () - -# The usual stuff -appName = "template" -app = KApplication (sys.argv, appName) -mainWindow = MainWin (None, "main window") - -# System tray apps need an icon -icons = KIconLoader () - -# The KSystemTray widget shows or hides it's parent widget -# when clicked, so parent needs to be the main window -systray = KSystemTray (mainWindow) - -systray.setPixmap (icons.loadIcon("stop", KIcon.Desktop)) -systray.connect (systray, SIGNAL ("quitSelected ()"), slotQuitSelected) -systray.show () - -# Comment this out if you don't want the main window to show -# immediately when the application loads -mainWindow.show() -app.exec_loop() - - diff --git a/python/pykde/templates/annotated/systray1.py b/python/pykde/templates/annotated/systray1.py deleted file mode 100644 index 99b7f03a..00000000 --- a/python/pykde/templates/annotated/systray1.py +++ /dev/null @@ -1,87 +0,0 @@ -""" -A basic system tray application - you can combine this with code from -menuapp2.py or menuapp3.py to quickly build a full-blown application -framework. -""" - -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - -import sys - -from qt import QLabel, QWidget, SIGNAL -from kdecore import KApplication, KIcon, KIconLoader -from kdeui import KMainWindow, KSystemTray - -# This template uses KMainWindow as the main window widget -# It solves the problem described in systray.py by using -# a flag to control the return value from queryClose - if -# :quit" is signalled from anywhere EXCEPT the system tray -# icon's menu, self.exitFlag == False, and as the return -# value for queryClose, it stops the application from shutting -# down; if self.exitFlag is True, the application shuts down - -class MainWin (KMainWindow): - def __init__ (self, *args): - apply (KMainWindow.__init__, (self,) + args) - - self.exitFlag = False - - icons = KIconLoader () - - # KSystemTray hides or shows its parent when the system tray icon is clicked - self.systray = KSystemTray (self) - self.systray.setPixmap (icons.loadIcon("stop", KIcon.Desktop)) - self.systray.connect (self.systray, SIGNAL ("quitSelected ()"), self.slotQuitSelected) - self.systray.show () - - # Controls whether or not the application really exits - def queryClose (self): - self.hide () - return self.exitFlag - - # Receives the signal emitted when the user selects Quit from the - # system tray icon's menu - def slotQuitSelected (self): - self.exitFlag = True - KApplication.kApplication ().quit () - -#-------------------- main ------------------------------------------------ - -# The usual stuff - you can also use the KAboutData/KCmdLineArgs version -# for program startup used in other templates - the KApplication constructor -# used here may be obsoleted eventually -appName = "template" -app = KApplication (sys.argv, appName) -mainWindow = MainWin (None, "main window") - -mainWindow.show() -app.exec_loop() - - diff --git a/python/pykde/templates/basic/basicapp.py b/python/pykde/templates/basic/basicapp.py deleted file mode 100644 index 2146f637..00000000 --- a/python/pykde/templates/basic/basicapp.py +++ /dev/null @@ -1,58 +0,0 @@ -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - -import sys - -from qt import SIGNAL -from kdecore import KApplication, KCmdLineArgs, KAboutData -from kdeui import KMainWindow - -class MainWin (KMainWindow): - def __init__ (self, *args): - KMainWindow.__init__ (self) - - -#-------------------- main ------------------------------------------------ - -description = "A basic application template" -version = "1.0" -aboutData = KAboutData ("", "",\ - version, description, KAboutData.License_GPL,\ - "(C) 2003 whoever the author is") - -aboutData.addAuthor ("author1", "whatever they did", "email@somedomain") -aboutData.addAuthor ("author2", "they did something else", "another@email.address") - -KCmdLineArgs.init (sys.argv, aboutData) - -app = KApplication () -mainWindow = MainWin (None, "main window") -mainWindow.show() -app.connect (app, SIGNAL ("lastWindowClosed ()"), app.quit) -app.exec_loop() diff --git a/python/pykde/templates/basic/menuapp1.py b/python/pykde/templates/basic/menuapp1.py deleted file mode 100644 index a482c2a2..00000000 --- a/python/pykde/templates/basic/menuapp1.py +++ /dev/null @@ -1,194 +0,0 @@ -""" -This template constructs an application with menus, toolbar and statusbar, -HOWEVER it is not recommended this template actually be used. It presents -the "KDE 1.0" method for constructing menus and toolbars - later versions -of KDE have introduced better (easier and more powerful) methods for -doing this job - see other menuapp*.py templates for these methods -""" - -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - - -False = 0 -True = not False - - -import sys - -from qt import QPopupMenu, SIGNAL - -from kdecore import KApplication, KCmdLineArgs, KAboutData, i18n, KStdAccel, KIcon, KIconLoader -from kdeui import KMainWindow, KMessageBox - -TOOLBAR_NEW = 1 -TOOLBAR_OPEN = 2 -TOOLBAR_SAVE = 3 -TOOLBAR_CUT = 4 -TOOLBAR_COPY = 5 -TOOLBAR_PASTE = 6 - -STATUSBAR_LEFT = 1 -STATUSBAR_MIDDLE = 2 -STATUSBAR_RIGHT = 3 - -class MainWin (KMainWindow): - def __init__ (self, *args): - apply (KMainWindow.__init__, (self,) + args) - - self.initMenus () - self.initToolBar () - self.initStatusBar () - - def initMenus (self): - fileMenu = QPopupMenu (self) - - # "File" menu items - fileMenu.insertItem (i18n ("New"), self.slotNew, KStdAccel.openNew ().keyCodeQt ()) - fileMenu.insertItem (i18n ("Open"), self.slotOpen, KStdAccel.open ().keyCodeQt ()) - fileMenu.insertSeparator (); - fileMenu.insertItem (i18n ("Save"), self.slotSave, KStdAccel.save ().keyCodeQt ()) - fileMenu.insertItem (i18n ("SaveAs"), self.slotSaveAs) - fileMenu.insertSeparator (); - fileMenu.insertItem (i18n ("Print"), self.slotPrint, KStdAccel.print_ ().keyCodeQt ()) - fileMenu.insertSeparator (); - fileMenu.insertItem (i18n ("&Quit"), self.slotQuit, KStdAccel.quit ().keyCodeQt ()); - - self.menuBar ().insertItem (i18n ("&File"), fileMenu) - - editMenu = QPopupMenu (self) - - # "Edit" menu items - editMenu.insertItem (i18n ("Undo"), self.slotUndo, KStdAccel.undo ().keyCodeQt ()) - editMenu.insertItem (i18n ("Redo"), self.slotRedo, KStdAccel.redo ().keyCodeQt ()) - editMenu.insertSeparator (); - editMenu.insertItem (i18n ("Cut"), self.slotCut, KStdAccel.cut ().keyCodeQt ()) - editMenu.insertItem (i18n ("Copy"), self.slotCopy, KStdAccel.copy ().keyCodeQt ()) - editMenu.insertItem (i18n ("Paste"), self.slotPaste, KStdAccel.paste ().keyCodeQt ()) - editMenu.insertSeparator (); - editMenu.insertItem (i18n ("Find"), self.slotFind, KStdAccel.find ().keyCodeQt ()) - editMenu.insertItem (i18n ("Find Next"), self.slotFindNext, KStdAccel.findNext ().keyCodeQt ()) - editMenu.insertItem (i18n ("Replace"), self.slotReplace, KStdAccel.replace ().keyCodeQt ()) - - self.menuBar ().insertItem (i18n ("&Edit"), editMenu) - - helpMenu = self.helpMenu ("") - self.menuBar ().insertItem (i18n ("&Help"), helpMenu) - - def initToolBar (self): - icons = KIconLoader () - - self.toolBar ().insertButton (icons.loadIcon ("filenew", KIcon.Toolbar), TOOLBAR_NEW, SIGNAL ("clicked (int)"), self.slotNew,\ - True, "New") - self.toolBar ().insertButton (icons.loadIcon ("fileopen", KIcon.Toolbar), TOOLBAR_OPEN, SIGNAL ("clicked (int)"), self.slotOpen,\ - True, "Open") - self.toolBar ().insertButton (icons.loadIcon ("filesave", KIcon.Toolbar), TOOLBAR_SAVE, SIGNAL ("clicked (int)"), self.slotSave,\ - True, "Save") - self.toolBar ().insertButton (icons.loadIcon ("editcut", KIcon.Toolbar), TOOLBAR_CUT, SIGNAL ("clicked (int)"), self.slotCut,\ - True, "Cut") - self.toolBar ().insertButton (icons.loadIcon ("editcopy", KIcon.Toolbar), TOOLBAR_COPY, SIGNAL ("clicked (int)"), self.slotCopy,\ - True, "Copy") - self.toolBar ().insertButton (icons.loadIcon ("editpaste", KIcon.Toolbar), TOOLBAR_PASTE, SIGNAL ("clicked (int)"), self.slotPaste,\ - True, "Paste") - - def initStatusBar (self): - self.statusBar ().insertItem ("", STATUSBAR_LEFT, 1000, True) - self.statusBar ().insertItem ("", STATUSBAR_MIDDLE, 1000, True) - self.statusBar ().insertItem ("", STATUSBAR_RIGHT, 1000, True) - - -#-------------------- slots ----------------------------------------------- - - def slotNew (self, id = -1): - self.notImpl ("New") - - def slotOpen(self, id = -1): - self.notImpl ("Open") - - def slotSave (self, id = -1): - self.notImpl ("Save") - - def slotSaveAs (self): - self.notImpl ("Save As") - - def slotPrint (self): - self.notImpl ("Print") - - def slotQuit (self): - self.notImpl ("Quit") - - def slotUndo (self): - self.notImpl ("Undo") - - def slotRedo (self): - self.notImpl ("Redo") - - def slotCut (self, id = -1): - self.notImpl ("Cut") - - def slotCopy (self, id = -1): - self.notImpl ("Copy") - - def slotPaste (self, id = -1): - self.notImpl ("Paste") - - def slotFind (self): - self.notImpl ("Find") - - def slotFindNext (self): - self.notImpl ("Find Next") - - def slotReplace (self): - self.notImpl ("Replace") - - def notImpl (self, item = "Feature"): - self.statusBar ().changeItem ("%s not implemented" % item, STATUSBAR_LEFT) - KMessageBox.error (self, "%s not implemented" % item, "Not Implemented") - self.statusBar ().changeItem ("", STATUSBAR_LEFT) - - -#-------------------- main ------------------------------------------------ - -description = "A basic application template" -version = "1.0" -aboutData = KAboutData ("", "",\ - version, description, KAboutData.License_GPL,\ - "(C) 2003 whoever the author is") - -aboutData.addAuthor ("author1", "whatever they did", "email@somedomain") -aboutData.addAuthor ("author2", "they did something else", "another@email.address") - -KCmdLineArgs.init (sys.argv, aboutData) - -KCmdLineArgs.addCmdLineOptions ([("+files", "File to open")]) - -app = KApplication () -mainWindow = MainWin (None, "main window") -mainWindow.show() -app.exec_loop() diff --git a/python/pykde/templates/basic/menuapp2.py b/python/pykde/templates/basic/menuapp2.py deleted file mode 100644 index 394eca80..00000000 --- a/python/pykde/templates/basic/menuapp2.py +++ /dev/null @@ -1,200 +0,0 @@ -""" -This template constructs an application with menus, toolbar and statusbar. -It uses KDE classes and methods that simplify the task of building and -operating a GUI. It is recommended that this approach be used, rather -than the primitive approach in menuapp1.py -""" - -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - - -False = 0 -True = not False - - -import sys - -from qt import QPopupMenu, SIGNAL - -from kdecore import KApplication, KCmdLineArgs, KAboutData, i18n, KShortcut -from kdeui import KMainWindow, KMessageBox, KStdAction, KAction - -STATUSBAR_LEFT = 1 -STATUSBAR_MIDDLE = 2 -STATUSBAR_RIGHT = 3 - -class MainWin (KMainWindow): - def __init__ (self, *args): - apply (KMainWindow.__init__, (self,) + args) - - self.initActions () - self.initMenus () - self.initToolBar () - self.initStatusBar () - - self.saveAction.setEnabled (False) - self.saveAsAction.setEnabled (False) - - def initActions (self): - # "File" menu items - self.newAction = KStdAction.openNew (self.slotNew, self.actionCollection ()) - self.openAction = KStdAction.open (self.slotOpen, self.actionCollection ()) - self.saveAction = KStdAction.save (self.slotSave, self.actionCollection ()) - self.saveAsAction = KStdAction.saveAs (self.slotSaveAs, self.actionCollection ()) - self.printAction = KStdAction.print_ (self.slotPrint, self.actionCollection ()) - self.quitAction = KStdAction.quit (self.slotQuit, self.actionCollection ()) - - # "Edit" menu items - self.undoAction = KStdAction.undo (self.slotUndo, self.actionCollection ()) - self.redoAction = KStdAction.redo (self.slotRedo, self.actionCollection ()) - self.cutAction = KStdAction.cut (self.slotCut, self.actionCollection ()) - self.copyAction = KStdAction.copy (self.slotCopy, self.actionCollection ()) - self.pasteAction = KStdAction.paste (self.slotPaste, self.actionCollection ()) - self.findAction = KStdAction.find (self.slotFind, self.actionCollection ()) - self.findNextAction = KStdAction.findNext (self.slotFindNext, self.actionCollection ()) - self.replaceAction = KStdAction.replace (self.slotReplace, self.actionCollection ()) - self.specialAction = KAction (i18n ("Special"), KShortcut.null (), self.slotSpecial, self.actionCollection (), None) - - def initMenus (self): - fileMenu = QPopupMenu (self) - self.newAction.plug (fileMenu) - self.openAction.plug (fileMenu) - fileMenu.insertSeparator () - self.saveAction.plug (fileMenu) - self.saveAsAction.plug (fileMenu) - fileMenu.insertSeparator () - self.printAction.plug (fileMenu) - fileMenu.insertSeparator () - self.quitAction.plug (fileMenu) - self.menuBar ().insertItem (i18n ("&File"), fileMenu) - - editMenu = QPopupMenu (self) - self.undoAction.plug (editMenu) - self.redoAction.plug (editMenu) - editMenu.insertSeparator () - self.cutAction.plug (editMenu) - self.copyAction.plug (editMenu) - self.pasteAction.plug (editMenu) - editMenu.insertSeparator () - self.findAction.plug (editMenu) - self.findNextAction.plug (editMenu) - self.replaceAction.plug (editMenu) - editMenu.insertSeparator () - self.specialAction.plug (editMenu) - self.menuBar ().insertItem (i18n ("&Edit"), editMenu) - - helpMenu = self.helpMenu ("") - self.menuBar ().insertItem (i18n ("&Help"), helpMenu) - - def initToolBar (self): - self.newAction.plug (self.toolBar ()) - self.openAction.plug (self.toolBar ()) - self.saveAction.plug (self.toolBar ()) - self.cutAction.plug (self.toolBar ()) - self.copyAction.plug (self.toolBar ()) - self.pasteAction.plug (self.toolBar ()) - - def initStatusBar (self): - self.statusBar ().insertItem ("", STATUSBAR_LEFT, 1000, True) - self.statusBar ().insertItem ("", STATUSBAR_MIDDLE, 1000, True) - self.statusBar ().insertItem ("", STATUSBAR_RIGHT, 1000, True) - -#-------------------- slots ----------------------------------------------- - - def slotNew (self, id = -1): - self.notImpl ("New") - - def slotOpen(self, id = -1): - self.notImpl ("Open") - - def slotSave (self, id = -1): - self.notImpl ("Save") - - def slotSaveAs (self): - self.notImpl ("Save As") - - def slotPrint (self): - self.notImpl ("Print") - - def slotQuit (self): - self.notImpl ("Quit") - - def slotUndo (self): - self.notImpl ("Undo") - - def slotRedo (self): - self.notImpl ("Redo") - - def slotCut (self, id = -1): - self.notImpl ("Cut") - - def slotCopy (self, id = -1): - self.notImpl ("Copy") - - def slotPaste (self, id = -1): - self.notImpl ("Paste") - - def slotFind (self): - self.notImpl ("Find") - - def slotFindNext (self): - self.notImpl ("Find Next") - - def slotReplace (self): - self.notImpl ("Replace") - - def slotSpecial (self): - self.notImpl ("Special") - - def notImpl (self, item = "Feature"): - self.statusBar ().changeItem ("%s not implemented" % item, STATUSBAR_LEFT) - KMessageBox.error (self, "%s not implemented" % item, "Not Implemented") - self.statusBar ().changeItem ("", STATUSBAR_LEFT) - - -#-------------------- main ------------------------------------------------ - -description = "A basic application template" -version = "1.0" -aboutData = KAboutData ("", "",\ - version, description, KAboutData.License_GPL,\ - "(C) 2003 whoever the author is") - -aboutData.addAuthor ("author1", "whatever they did", "email@somedomain") -aboutData.addAuthor ("author2", "they did something else", "another@email.address") - -KCmdLineArgs.init (sys.argv, aboutData) - -KCmdLineArgs.addCmdLineOptions ([("+files", "File to open")]) - -app = KApplication () -mainWindow = MainWin (None, "main window") -mainWindow.show() -app.exec_loop() diff --git a/python/pykde/templates/basic/menuapp3.py b/python/pykde/templates/basic/menuapp3.py deleted file mode 100644 index e729d6d1..00000000 --- a/python/pykde/templates/basic/menuapp3.py +++ /dev/null @@ -1,162 +0,0 @@ -""" -This template constructs an application with menus, toolbar and statusbar. -It uses an XML file (menuapp3ui.rc) to specify the menu layout; all menu -items have a corresponding action defined, but no menus are created -explicitly in code. This app has the same menu layout as menuapp2.py -""" - -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - - -False = 0 -True = not False - - -import sys - -from qt import QPopupMenu, SIGNAL - -from kdecore import KApplication, KCmdLineArgs, KAboutData, i18n, KShortcut -from kdeui import KMainWindow, KMessageBox, KStdAction, KAction, KActionCollection - -STATUSBAR_LEFT = 1 -STATUSBAR_MIDDLE = 2 -STATUSBAR_RIGHT = 3 - -class MainWin (KMainWindow): - def __init__ (self, *args): - apply (KMainWindow.__init__, (self,) + args) - - self.initActions () - self.createGUI () - self.initStatusBar () - - self.saveAction.setEnabled (False) - self.saveAsAction.setEnabled (False) - - def initActions (self): - # "File" menu items - self.newAction = KStdAction.openNew (self.slotNew, self.actionCollection ()) - self.openAction = KStdAction.open (self.slotOpen, self.actionCollection ()) - self.saveAction = KStdAction.save (self.slotSave, self.actionCollection ()) - self.saveAsAction = KStdAction.saveAs (self.slotSaveAs, self.actionCollection ()) - self.printAction = KStdAction.print_ (self.slotPrint, self.actionCollection ()) - self.quitAction = KStdAction.quit (self.slotQuit, self.actionCollection ()) - - - # "Edit" menu items - self.undoAction = KStdAction.undo (self.slotUndo, self.actionCollection ()) - self.redoAction = KStdAction.redo (self.slotRedo, self.actionCollection ()) - self.cutAction = KStdAction.cut (self.slotCut, self.actionCollection ()) - self.copyAction = KStdAction.copy (self.slotCopy, self.actionCollection ()) - self.pasteAction = KStdAction.paste (self.slotPaste, self.actionCollection ()) - self.findAction = KStdAction.find (self.slotFind, self.actionCollection ()) - self.findNextAction = KStdAction.findNext (self.slotFindNext, self.actionCollection ()) - self.replaceAction = KStdAction.replace (self.slotReplace, self.actionCollection ()) - self.specialAction = KAction (i18n ("Special"), KShortcut.null (), self.slotSpecial, self.actionCollection (), "specialActionName") - - def initStatusBar (self): - self.statusBar ().insertItem ("", STATUSBAR_LEFT, 1000, True) - self.statusBar ().insertItem ("", STATUSBAR_MIDDLE, 1000, True) - self.statusBar ().insertItem ("", STATUSBAR_RIGHT, 1000, True) - -#-------------------- slots ----------------------------------------------- - - def slotNew (self, id = -1): - self.notImpl ("New") - - def slotOpen(self, id = -1): - self.notImpl ("Open") - - def slotSave (self, id = -1): - self.notImpl ("Save") - - def slotSaveAs (self): - self.notImpl ("Save As") - - def slotPrint (self): - self.notImpl ("Print") - - def slotQuit (self): - self.notImpl ("Quit") - - def slotUndo (self): - self.notImpl ("Undo") - - def slotRedo (self): - self.notImpl ("Redo") - - def slotCut (self, id = -1): - self.notImpl ("Cut") - - def slotCopy (self, id = -1): - self.notImpl ("Copy") - - def slotPaste (self, id = -1): - self.notImpl ("Paste") - - def slotFind (self): - self.notImpl ("Find") - - def slotFindNext (self): - self.notImpl ("Find Next") - - def slotReplace (self): - self.notImpl ("Replace") - - def slotSpecial (self): - self.notImpl ("Special") - - def notImpl (self, item = "Feature"): - self.statusBar ().changeItem ("%s not implemented" % item, STATUSBAR_LEFT) - KMessageBox.error (self, "%s not implemented" % item, "Not Implemented") - self.statusBar ().changeItem ("", STATUSBAR_LEFT) - - -#-------------------- main ------------------------------------------------ - -description = "A basic application template" -version = "1.0" -aboutData = KAboutData ("menuapp3", "",\ - version, description, KAboutData.License_GPL,\ - "(C) 2003 whoever the author is") - -aboutData.addAuthor ("author1", "whatever they did", "email@somedomain") -aboutData.addAuthor ("author2", "they did something else", "another@email.address") - -KCmdLineArgs.init (sys.argv, aboutData) - -KCmdLineArgs.addCmdLineOptions ([("+files", "File to open")]) - -app = KApplication () -mainWindow = MainWin (None, "main window") -mainWindow.show() -app.exec_loop() - diff --git a/python/pykde/templates/basic/menuapp3ui.rc b/python/pykde/templates/basic/menuapp3ui.rc deleted file mode 100644 index 60120e21..00000000 --- a/python/pykde/templates/basic/menuapp3ui.rc +++ /dev/null @@ -1,24 +0,0 @@ -<!DOCTYPE kpartgui> -<kpartgui name = "menuapp3"> -<MenuBar> - <Menu name="file"><text>&File</text> - <Action name ="newAction"/> - <Action name ="openAction"/> - <Action name ="saveAction"/> - <Action name ="saveAsAction"/> - <Action name ="printAction"/> - <Action name ="quitAction"/> - </Menu> - <Menu name = "edit"><text>&Edit</text> - <Action name ="undoAction"/> - <Action name ="redoAction"/> - <Action name ="cutAction"/> - <Action name ="copyAction"/> - <Action name ="pasteAction"/> - <Action name ="findAction"/> - <Action name ="findNextAction"/> - <Action name ="replaceAction"/> - <Action name ="specialActionName"/> - </Menu> -</MenuBar> -</kpartgui>
\ No newline at end of file diff --git a/python/pykde/templates/basic/minimal.py b/python/pykde/templates/basic/minimal.py deleted file mode 100644 index 72ff3bea..00000000 --- a/python/pykde/templates/basic/minimal.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - -import sys - -from kdecore import KApplication -from kdeui import KMainWindow - -class MainWin (KMainWindow): - def __init__ (self, *args): - apply (KMainWindow.__init__, (self,) + args) - - -#-------------------- main ------------------------------------------------ - -appName = "template" -app = KApplication (sys.argv, appName) -mainWindow = MainWin (None, "main window") -mainWindow.show() -app.exec_loop() - - diff --git a/python/pykde/templates/basic/panelapplet.py b/python/pykde/templates/basic/panelapplet.py deleted file mode 100644 index 4ac8016f..00000000 --- a/python/pykde/templates/basic/panelapplet.py +++ /dev/null @@ -1,49 +0,0 @@ -""" -A basic panel applet template - working examples are in the -pykpanelapplet/ directory -""" -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - -from kdeui import PyKPanelApplet, KPanelApplet - - -def createApplet (parent, configFile): - return PanelAppletName (configFile, KPanelApplet.Normal, 0, parent, "nameMe") - - -class PanelAppletName (PyKPanelApplet): - def __init__ (self, configFile, t, actions, parent, name, f = 0): - PyKPanelApplet.__init__ (self, configFile, t, actions, parent, name, f) - - def widthForHeight (self, h): - return h - - def heightForWidth (self, w ): - return w diff --git a/python/pykde/templates/basic/systray.py b/python/pykde/templates/basic/systray.py deleted file mode 100644 index 1363dac7..00000000 --- a/python/pykde/templates/basic/systray.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - -import sys - -from qt import QWidget, SIGNAL -from kdecore import KApplication, KIcon, KIconLoader -from kdeui import KSystemTray - - -class MainWin (QWidget): - def __init__ (self, *args): - apply (QWidget.__init__, (self,) + args) - -#-------------------- main ------------------------------------------------ - -def slotQuitSelected (): - KApplication.kApplication ().quit () - -appName = "template" -app = KApplication (sys.argv, appName) -mainWindow = MainWin (None, "main window") - -icons = KIconLoader () - -systray = KSystemTray (mainWindow) - -systray.setPixmap (icons.loadIcon("stop", KIcon.Desktop)) -systray.connect (systray, SIGNAL ("quitSelected ()"), slotQuitSelected) -systray.show () - -mainWindow.show() -app.exec_loop() - - diff --git a/python/pykde/templates/basic/systray1.py b/python/pykde/templates/basic/systray1.py deleted file mode 100644 index bd5da9d4..00000000 --- a/python/pykde/templates/basic/systray1.py +++ /dev/null @@ -1,67 +0,0 @@ -""" -Copyright 2003 Jim Bublitz - -Terms and Conditions - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the copyright holder shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from the -copyright holder. -""" - -import sys - -from qt import QLabel, QWidget, SIGNAL -from kdecore import KApplication, KIcon, KIconLoader -from kdeui import KMainWindow, KSystemTray - -class MainWin (KMainWindow): - def __init__ (self, *args): - apply (KMainWindow.__init__, (self,) + args) - - self.exitFlag = False - - icons = KIconLoader () - - self.systray = KSystemTray (self) - self.systray.setPixmap (icons.loadIcon("stop", KIcon.Desktop)) - self.systray.connect (self.systray, SIGNAL ("quitSelected ()"), self.slotQuitSelected) - self.systray.show () - - def queryClose (self): - self.hide () - return self.exitFlag - - def slotQuitSelected (self): - self.exitFlag = True - KApplication.kApplication ().quit () - -#-------------------- main ------------------------------------------------ - - -appName = "template" -app = KApplication (sys.argv, appName) -mainWindow = MainWin (None, "main window") - -mainWindow.show() -app.exec_loop() - - |