Logo Search packages:      
Sourcecode: veusz version File versions  Download package

def veusz-1.10::windows::mainwindow::MainWindow::_defineMenus (   self ) [private]
Initialise the menus and toolbar.

Definition at line 333 of file mainwindow.py.

                          :
        """Initialise the menus and toolbar."""

        # these are actions for main menu toolbars and menus
        a = utils.makeAction
        self.vzactions = {
            'file.new':
                a(self, 'New document', '&New',
                  self.slotFileNew,
                  icon='kde-document-new', key='Ctrl+N'),
            'file.open':
                a(self, 'Open a document', '&Open...',
                  self.slotFileOpen,
                  icon='kde-document-open', key='Ctrl+O'),
            'file.save':
                a(self, 'Save the document', '&Save',
                  self.slotFileSave,
                  icon='kde-document-save', key='Ctrl+S'),
            'file.saveas':
                a(self, 'Save the current graph under a new name',
                  'Save &As...', self.slotFileSaveAs,
                  icon='kde-document-save-as'),
            'file.print':
                a(self, 'Print the document', '&Print...',
                  self.slotFilePrint,
                  icon='kde-document-print', key='Ctrl+P'),
            'file.export':
                a(self, 'Export the current page', '&Export...',
                  self.slotFileExport,
                  icon='kde-document-export'),
            'file.close':
                a(self, 'Close current window', 'Close Window',
                  self.slotFileClose,
                  icon='kde-window-close', key='Ctrl+W'),
            'file.quit':
                a(self, 'Exit the program', '&Quit',
                  self.slotFileQuit,
                  icon='kde-application-exit', key='Ctrl+Q'),
            
            'edit.undo':
                a(self, 'Undo the previous operation', 'Undo',
                  self.slotEditUndo,
                  icon='kde-edit-undo',  key='Ctrl+Z'),
            'edit.redo':
                a(self, 'Redo the previous operation', 'Redo',
                  self.slotEditRedo,
                  icon='kde-edit-redo', key='Ctrl+Shift+Z'),
            'edit.prefs':
                a(self, 'Edit preferences', 'Preferences...',
                  self.slotEditPreferences,
                  icon='veusz-edit-prefs'),
            'edit.custom':
                a(self, 'Edit custom functions and constants',
                  'Custom definitions...',
                  self.slotEditCustom,
                  icon='veusz-edit-custom'),

            'edit.stylesheet':
                a(self,
                  'Edit stylesheet to change default widget settings',
                  'Default styles...',
                  self.slotEditStylesheet, icon='settings_stylesheet'),

            'view.edit':
                a(self, 'Show or hide edit window', 'Edit window',
                  None, checkable=True),
            'view.props':
                a(self, 'Show or hide property window', 'Properties window',
                  None, checkable=True),
            'view.format':
                a(self, 'Show or hide formatting window', 'Formatting window',
                  None, checkable=True),
            'view.console':
                a(self, 'Show or hide console window', 'Console window',
                  None, checkable=True),
            'view.maintool':
                a(self, 'Show or hide main toolbar', 'Main toolbar',
                  None, checkable=True),
            'view.datatool':
                a(self, 'Show or hide data toolbar', 'Data toolbar',
                  None, checkable=True),
            'view.viewtool':
                a(self, 'Show or hide view toolbar', 'View toolbar',
                  None, checkable=True),
            'view.edittool':
                a(self, 'Show or hide editing toolbar', 'Editing toolbar',
                  None, checkable=True),
            'view.addtool':
                a(self, 'Show or hide insert toolbar', 'Insert toolbar',
                  None, checkable=True),
            
            'data.import':
                a(self, 'Import data into Veusz', '&Import...',
                  self.slotDataImport, icon='kde-vzdata-import'),
            'data.edit':
                a(self, 'Edit existing datasets', '&Edit...',
                  self.slotDataEdit, icon='kde-edit-veuszedit'),
            'data.create':
                a(self, 'Create new datasets', '&Create...',
                  self.slotDataCreate, icon='kde-dataset-new-veuszedit'),
            'data.create2d':
                a(self, 'Create new 2D datasets', 'Create &2D...',
                  self.slotDataCreate2D, icon='kde-dataset2d-new-veuszedit'),
            'data.capture':
                a(self, 'Capture remote data', 'Ca&pture...',
                  self.slotDataCapture, icon='veusz-capture-data'),
            'data.histogram':
                a(self, 'Histogram data', '&Histogram...',
                  self.slotDataHistogram, icon='button_bar'),
            'data.reload':
                a(self, 'Reload linked datasets', '&Reload',
                  self.slotDataReload, icon='kde-view-refresh'),

            'help.home':
                a(self, 'Go to the Veusz home page on the internet',
                  'Home page', self.slotHelpHomepage),
            'help.project':
                a(self, 'Go to the Veusz project page on the internet',
                  'GNA Project page', self.slotHelpProjectPage),
            'help.bug':
                a(self, 'Report a bug on the internet',
                  'Suggestions and bugs', self.slotHelpBug),
            'help.about':
                a(self, 'Displays information about the program', 'About...',
                  self.slotHelpAbout, icon='veusz')
            }

        # create main toolbar
        tb = self.maintoolbar = qt4.QToolBar("Main toolbar - Veusz", self)
        iconsize = setdb['toolbar_size']
        tb.setIconSize(qt4.QSize(iconsize, iconsize))
        tb.setObjectName('veuszmaintoolbar')
        self.addToolBar(qt4.Qt.TopToolBarArea, tb)
        utils.addToolbarActions(tb, self.vzactions, 
                                ('file.new', 'file.open', 'file.save',
                                 'file.print', 'file.export'))

        # data toolbar
        tb = self.datatoolbar = qt4.QToolBar("Data toolbar - Veusz", self)
        tb.setIconSize(qt4.QSize(iconsize, iconsize))
        tb.setObjectName('veuszdatatoolbar')
        self.addToolBar(qt4.Qt.TopToolBarArea, tb)
        utils.addToolbarActions(tb, self.vzactions,
                                ('data.import', 'data.edit',
                                 'data.create', 'data.capture',
                                 'data.reload'))

        # menu structure
        filemenu = [
            'file.new', 'file.open',
            ['file.filerecent', 'Open &Recent', []],
            '',
            'file.save', 'file.saveas',
            '',
            'file.print', 'file.export',
            '',
            'file.close', 'file.quit'
            ]
        editmenu = [
            'edit.undo', 'edit.redo',
            '',
            'edit.prefs', 'edit.stylesheet', 'edit.custom',
            ''
            ]
        viewwindowsmenu = [
            'view.edit', 'view.props', 'view.format',
            'view.console',
            '',
            'view.maintool', 'view.viewtool',
            'view.addtool', 'view.edittool'
            ]
        viewmenu = [
            ['view.viewwindows', '&Windows', viewwindowsmenu],
            ''
            ]
        insertmenu = [
            ]

        # load dataset plugins and create menu
        datapluginsmenu = self.definePlugins( plugins.datasetpluginregistry,
                                              self.vzactions, 'data.ops' )

        datamenu = [
            ['data.ops', '&Operations', datapluginsmenu],
            'data.import', 'data.edit', 'data.create',
            'data.create2d', 'data.capture', 'data.histogram',
            'data.reload',
            ]
        helpmenu = [
            'help.home', 'help.project', 'help.bug',
            '',
            'help.about'
            ]

        # load tools plugins and create menu
        toolsmenu = self.definePlugins( plugins.toolspluginregistry,
                                        self.vzactions, 'tools' )

        menus = [
            ['file', '&File', filemenu],
            ['edit', '&Edit', editmenu],
            ['view', '&View', viewmenu],
            ['insert', '&Insert', insertmenu],
            ['data', '&Data', datamenu],
            ['tools', '&Tools', toolsmenu],
            ['help', '&Help', helpmenu],
            ]

        self.menus = {}
        utils.constructMenus(self.menuBar(), self.menus, menus, self.vzactions)


Generated by  Doxygen 1.6.0   Back to index