예제 #1
0
파일: __init__.py 프로젝트: warvariuc/wic
    def setupMenu(self):
        super().setupMenu()

        #Add actions for catalogs.
        # http://docs.python.org/library/pkgutil.html#pkgutil.walk_packages
        menu = self.menu.catalogs
        from wic import menus
        catalogs = ('persons', 'locations', 'districts', 'regions', 'streets')
        for catalog in catalogs:
            modelName = catalog.capitalize()
            modelPath = 'papp.catalogs.' + catalog + '.' + modelName
            menus.addActionsToMenu(menu, (
                menus.createAction(menu, modelName, lambda *args, p = modelPath: forms.openCatalogForm(p, db),
                                   icon = ':/icons/fugue/cards-address.png'),
            ))

        menu = self.menu.reports
        reports = ('phone_number_search', 'test', 'lissajous', 'repayment_schedule')
        for report in reports:
            reportName = report.capitalize()
            reportPath = 'papp.reports.' + report + '.Form'
            menus.addActionsToMenu(menu, (
                menus.createAction(menu, reportName, lambda *args, p = reportPath: forms.openForm(p),
                                   icon = ':/icons/fugue/application-form.png'),
            ))
예제 #2
0
 def showContextMenu(self, coord):
     if not hasattr(self, 'menu'): # create the context menu for Message Window
         self.menu = QtGui.QMenu(self.textEdit)
         menus.addActionsToMenu(self.menu, (
             menus.createAction(self.textEdit, 'Clear', self.textEdit.clear, icon = ':/icons/fugue/eraser.png'),
             menus.createAction(self.textEdit, 'Copy', self.textEdit.copy, QtGui.QKeySequence.Copy, ':/icons/fugue/document-copy.png'),
             menus.createAction(self.textEdit, 'Select all', self.textEdit.selectAll, QtGui.QKeySequence.SelectAll, ':/icons/fugue/selection-select.png'),
         ))
     self.menu.popup(self.textEdit.mapToGlobal(coord))
예제 #3
0
파일: __init__.py 프로젝트: warvariuc/wic
 def setupToolbar(self, toolbar):
     assert isinstance(toolbar, QtGui.QToolBar)
     menu = Bunch()
     menu.createItem = menus.createAction(toolbar, 'Create new item', self.createItem, 'Insert', ':/icons/fugue/plus.png')
     menu.editItem = menus.createAction(toolbar, 'Edit selected item', self.editItem, 'Enter', ':/icons/fugue/pencil.png')
     menu.deleteItem = menus.createAction(toolbar, 'Delete selected item', self.deleteItem, 'Delete', ':/icons/fugue/cross.png')
     menus.addActionsToMenu(toolbar, (menu.createItem, menu.editItem, menu.deleteItem))
     toolbar.setIconSize(QtCore.QSize(16, 16))
     self.menu = menu
예제 #4
0
 def contextMenuEvent(self, qContextMenuEvent):
     menu = getattr(self, 'menu', None)
     if not menu:
         from wic import menus
         menu = QtGui.QMenu(self) # context menu
         menus.addActionsToMenu(menu, (
             menus.createAction(menu, 'Select', self.selectItem, 'Insert', ':/icons/fugue/cards-stack.png'),
             menus.createAction(menu, 'Open', self.openItem, 'Space', ':/icons/fugue/card-address.png'),
             menus.createAction(menu, 'Clear', self.clear, 'Delete', ':/icons/fugue/eraser.png'),
         ))
         self.menu = menu
     menu.popup(qContextMenuEvent.globalPos())
예제 #5
0
파일: __init__.py 프로젝트: warvariuc/wic
    def onContextMenuRequested(self, coord):
        from wic import menus

        menu = QtGui.QMenu(self)
        menus.addActionsToMenu(menu, (menus.createAction(menu, "Save this form into a *.ui file.", self.saveFormToUi),))
        menu.popup(self.mapToGlobal(coord))
예제 #6
0
파일: __init__.py 프로젝트: warvariuc/wic
 def onTableViewContextMenuRequested(self, coord):
     menu = QtGui.QMenu(self.tableView)
     menus.addActionsToMenu(menu, (self.menu.createItem, self.menu.editItem, self.menu.deleteItem))
     menu.popup(self.tableView.viewport().mapToGlobal(coord))