示例#1
0
	def createActions(self):
		""" Function to create actions for menus
		"""
		self.newAction=QAction( QIcon(), '&New', 
								self, 
								shortcut=QKeySequence.New, 
								statusTip="Create a New file" )
		self.exitAction=QAction( QIcon(), '&Exit',
								 self,
								 shortcut="Ctrl+Q",
								 statusTip="Exit the application",
								 triggered=self.exitFile )
		self.copyAction=QAction( QIcon(), '&Copy',
								 self,
								 shortcut="Ctrl+C",
								 statusTip="Copy",
								 triggered=self.textEdit.copy )
		self.pasteAction=QAction( QIcon(), '&Paste',
								  self,
								  shortcut="Ctrl+V",
								  triggered=self.textEdit.paste)
		self.aboutAction=QAction( QIcon(), '&About',
								  self,
								  statusTip="Displays info",
								  triggered=self.aboutHelp )
示例#2
0
    def __CreateActions(self):
        """ Function to create actions for menus """
        self.stdAction = QAction(QIcon('convert.png'), 
                                'Create MKV files',
                                self, shortcut = "Ctrl+K",
                                statusTip = "File format set to MKV container",
                                triggered = self.stdConversion,
                                checkable = True)

        self.altAction = QAction(QIcon('convert.png'), 
                                'Create MP4 files',
                                self, shortcut = "Ctrl+P",
                                statusTip = "File format set to MP4 file",
                                triggered = self.altConversion,
                                checkable = True)

        self.exitAction = QAction(QIcon('exit.png'),
                                  '&Quit',
                                  self, shortcut="Ctrl+Q",
                                  statusTip = "Exit the Application",
                                  triggered=self.exitFile)

        #self.copyAction = QAction(QIcon('copy.png'), 'C&opy',
                                  #self, shortcut="Ctrl+C",
                                  #statusTip="Copy",
                                  #triggered=self.CopyFunction)

        self.aboutAction = QAction(QIcon('about.png'), 'A&bout',
                                   self, statusTip="Displays info about ManageHD",
                                   triggered=self.aboutHelp)
示例#3
0
 def createTray(self):
     restoreAction = QAction("&Restore", self, triggered=self.showNormal)
     quitAction = QAction("&Quit", self, triggered=qApp.quit)
     self.trayIconMenu.addAction(restoreAction)
     self.trayIconMenu.addAction(quitAction)
     self.trayIcon.setContextMenu(self.trayIconMenu)
     self.trayIcon.show()
示例#4
0
 def testSignal(self):
     o = QWidget()
     act = QAction(o)
     self._called = False
     act.triggered.connect(self._cb)
     act.trigger()
     self.assert_(self._called)
示例#5
0
    def CreateActions(self):
        """ Function to create actions for menus
        """
        self.newAction = QAction(QIcon('new.png'),
                                 '&New',
                                 self,
                                 shortcut=QKeySequence.New,
                                 statusTip="Create a New File",
                                 triggered=self.newFile)
        self.copyAction = QAction(QIcon('copy.png'),
                                  'C&opy',
                                  self,
                                  shortcut="Ctrl+C",
                                  statusTip="Copy",
                                  triggered=self.textEdit.copy)
        self.pasteAction = QAction(QIcon('paste.png'),
                                   '&Paste',
                                   self,
                                   shortcut="Ctrl+V",
                                   statusTip="Paste",
                                   triggered=self.textEdit.paste)
        self.aboutAction = QAction(QIcon('about.png'),
                                   'A&bout',
                                   self,
                                   statusTip="Displays info about text editor",
                                   triggered=self.aboutHelp)

        self.exitAction = QAction(QIcon('exit.png'),
                                  'E&xit',
                                  self,
                                  shortcut="Ctrl+Q",
                                  statusTip="Exit the Application",
                                  triggered=self.exitFile)
示例#6
0
 def testSignal(self):
     o = QWidget()
     act = QAction(o)
     self._called = False
     act.triggered.connect(self._cb)
     act.trigger()
     self.assert_(self._called)
示例#7
0
 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     self.setWindowFilePath('No file')
     # the media object controls the playback
     self.media = Phonon.MediaObject(self)
     # the audio output does the actual sound playback
     self.audio_output = Phonon.AudioOutput(Phonon.MusicCategory, self)
     # a slider to seek to any given position in the playback
     self.seeker = Phonon.SeekSlider(self)
     self.setCentralWidget(self.seeker)
     # link media objects together.  The seeker will seek in the created
     # media object
     self.seeker.setMediaObject(self.media)
     # audio data from the media object goes to the audio output object
     Phonon.createPath(self.media, self.audio_output)
     # set up actions to control the playback
     self.actions = self.addToolBar('Actions')
     for name, label, icon_name in self.ACTIONS:
         icon = self.style().standardIcon(icon_name)
         action = QAction(icon, label, self)
         action.setObjectName(name)
         self.actions.addAction(action)
         if name == 'open':
             action.triggered.connect(self._ask_open_filename)
         else:
             action.triggered.connect(getattr(self.media, name))
     # whenever the playback state changes, show a message to the user
     self.media.stateChanged.connect(self._show_state_message)
示例#8
0
 def showContextMenu(self, point):
     'Show the Columns context menu'
     if self.model() is None:
         return
     
     # If we are viewing a proxy model, skip to the source model
     mdl = self.model()
     while isinstance(mdl, QAbstractProxyModel):
         mdl = mdl.sourceModel()
     
     if mdl is None or not hasattr(mdl, 'columns'):
         return
     
     # Generate and show the Menu
     m = QMenu()
     for i in range(len(mdl.columns)):
         c = mdl.columns[i]
         if c.internal:
             continue
         
         a = QAction(mdl.headerData(i, Qt.Horizontal, Qt.DisplayRole), m)
         a.setCheckable(True)
         a.setChecked(not self.isColumnHidden(i))
         a.triggered.connect(partial(self.showHideColumn, c=i, s=self.isColumnHidden(i)))
         m.addAction(a)
         
     m.exec_(self.header().mapToGlobal(point))
示例#9
0
 def __init__(self):
     QAction.__init__(self, "Set Poster Frame", None)
     self.triggered.connect(self.setPosterFrameForActiveSequence)
     hiero.core.events.registerInterest("kShowContextMenu/kViewer", self.eventHandler)
     self.setObjectName("foundry.viewer.setPosterFrame")
     self.setShortcut("Shift+P")
     self.currentViewer = None
    def _create_theme_menu(self):
        theme_menu = QMenu(self)
        theme_menu.setTitle('Buttons Theme')
        theme_menu.setTearOffEnabled(True)
        theme_menu.setWindowTitle(TAG)
        theme_actions = QActionGroup(self)
        theme_actions.setExclusive(True)
        # create ordered theme list
        custom_order_theme = sorted(THEMES.iterkeys())
        custom_order_theme.remove('Maya Theme')
        custom_order_theme.insert(0, 'Maya Theme')
        default_item = True
        for theme in custom_order_theme:
            current_theme_action = QAction(theme, theme_actions)
            current_theme_action.setCheckable(True)
            current_theme_action.setChecked(
                MTTSettings.value('theme', 'Maya Theme') == theme)
            current_theme_action.triggered.connect(self.on_change_theme)
            theme_menu.addAction(current_theme_action)

            if default_item:
                theme_menu.addSeparator()
                default_item = False

        return theme_menu
    def on_show_prompt_instance_delay_menu(self):
        prompt_instance_state = cmds.optionVar(query='MTT_prompt_instance_state')

        if prompt_instance_state == PROMPT_INSTANCE_WAIT:
            elapsed_time = time() - cmds.optionVar(query='MTT_prompt_instance_suspend')
            if elapsed_time > PROMPT_INSTANCE_WAIT_DURATION:
                prompt_instance_state = PROMPT_INSTANCE_ASK
                cmds.optionVar(iv=['MTT_prompt_instance_state', prompt_instance_state])
            else:
                mtt_log('Remaining %.2fs' % (PROMPT_INSTANCE_WAIT_DURATION - elapsed_time))
        elif prompt_instance_state == PROMPT_INSTANCE_SESSION:
            if 'mtt_prompt_session' not in __main__.__dict__:
                prompt_instance_state = PROMPT_INSTANCE_ASK
                cmds.optionVar(iv=['MTT_prompt_instance_state', prompt_instance_state])

        self.instance_menu.clear()

        prompt_delay = QActionGroup(self)
        prompt_delay.setExclusive(True)
        for i in range(len(PROMPT_INSTANCE_STATE.keys())):
            current_delay_action = QAction(PROMPT_INSTANCE_STATE[i], prompt_delay)
            current_delay_action.setCheckable(True)
            current_delay_action.setChecked(prompt_instance_state == i)
            current_delay_action.triggered.connect(
                partial(self.view.on_choose_instance_delay, i, prompt=i != 0))
            self.instance_menu.addAction(current_delay_action)
示例#12
0
    def createUserInfoContextMenu(self):
        '''添加用户信息快捷菜单'''
        #pylint: disable=W0201
        self.addUserAct = QAction(self)
#        self.addUserAct.setText("add User")
        
        self.delUserAct = QAction(self)
#        self.delUserAct.setText("del User")

        self.undoDelUserAct = QAction(self)
#        self.undoDelUserAct.setText("undo del User")
        
        self.saveDataRowAct = QAction(self)
#        self.saveDataRowAct.setText("save Data")
        
        self.ui.userInfo_tableView.addAction(self.addUserAct)
        self.ui.userInfo_tableView.addAction(self.delUserAct)
        self.ui.userInfo_tableView.addAction(self.undoDelUserAct)
        self.ui.userInfo_tableView.addAction(self.saveDataRowAct)
        
        QObject.connect(self.addUserAct, SIGNAL("activated()"), self, SLOT("userInfoAddRow()"))
        QObject.connect(self.delUserAct, SIGNAL("activated()"), self, SLOT("userInfoDelRow()"))
        QObject.connect(self.undoDelUserAct, SIGNAL("activated()"), self, SLOT("userInfoUndoDelRow()"))        
        QObject.connect(self.saveDataRowAct, SIGNAL("activated()"), self, SLOT("userInfoSaveData()"))
        
        self.ui.userInfo_tableView.setContextMenuPolicy(Qt.ActionsContextMenu)
示例#13
0
 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     self.setWindowFilePath('No file')
     # the media object controls the playback
     self.media = Phonon.MediaObject(self)
     # the audio output does the actual sound playback
     self.audio_output = Phonon.AudioOutput(Phonon.MusicCategory, self)
     # a slider to seek to any given position in the playback
     self.seeker = Phonon.SeekSlider(self)
     self.setCentralWidget(self.seeker)
     # link media objects together.  The seeker will seek in the created
     # media object
     self.seeker.setMediaObject(self.media)
     # audio data from the media object goes to the audio output object
     Phonon.createPath(self.media, self.audio_output)
     # set up actions to control the playback
     self.actions = self.addToolBar('Actions')
     for name, label, icon_name in self.ACTIONS:
         icon = self.style().standardIcon(icon_name)
         action = QAction(icon, label, self)
         action.setObjectName(name)
         self.actions.addAction(action)
         if name == 'open':
             action.triggered.connect(self._ask_open_filename)
         else:
             action.triggered.connect(getattr(self.media, name))
     # whenever the playback state changes, show a message to the user
     self.media.stateChanged.connect(self._show_state_message)
示例#14
0
    def setupContextMenu(self, vobj, menu):
        """Set up the object's context menu in GUI (callback)."""
        action1 = QAction(QT_TRANSLATE_NOOP("Render",
                                            "Set GUI to this camera"),
                          menu)
        QObject.connect(action1,
                        SIGNAL("triggered()"),
                        self.set_gui_from_camera)
        menu.addAction(action1)

        action2 = QAction(QT_TRANSLATE_NOOP("Render",
                                            "Set this camera to GUI"),
                          menu)
        QObject.connect(action2,
                        SIGNAL("triggered()"),
                        self.set_camera_from_gui)
        menu.addAction(action2)

        action3 = QAction(QT_TRANSLATE_NOOP("Render",
                                            "Point at..."),
                          menu)
        QObject.connect(action3,
                        SIGNAL("triggered()"),
                        self.point_at)
        menu.addAction(action3)
示例#15
0
    def updateRecentFilesMenu(self):
        #If there is a current file open, add it to the recent files list.
        if self.file_name and MainWindow.recentFiles.count(self.file_name) == 0:
            #Prepend the file to recentFiles
            MainWindow.recentFiles.insert(0, self.file_name)
            #This this is the only time files get added to recentFiles,
            #enforce the maximum length of recentFiles now.
            while len(MainWindow.recentFiles) > 9:
                MainWindow.recentFiles.pop()

        recent_files = []

        #For each file in recentFiles, check that it exists and is readable.
        for fname in MainWindow.recentFiles:
            if os.access(fname, os.F_OK):
                recent_files.append(fname)

        MainWindow.recentFiles = recent_files

        #Now create an action for each file.
        if recent_files:
            action_list = []
            for i, fname in enumerate(recent_files):
                new_action = QAction("%d. %s"%(i, fname), self, triggered=self.openRecentFile)
                new_action.setData(fname)
                action_list.append(new_action)
            #Now update the recent files menu on every window.
            for window in MainWindow.instances:
                window.menuRecent.clear()
                window.menuRecent.addActions(action_list)
示例#16
0
 def createActions(self):
     """Création des différentes actions du menu
        '&' permet de surligner une lettre pour acès rapide Alt+lettre
        'shortcut' permet de définir le raccourci de l'action du menu
        'statusTip' permet de modifier l'affichage dans la barre de status
        'triggered' permet de définir l'action à réaliser"""
     self.newAction = QAction('&New',
                              self,
                              shortcut=QKeySequence.New,
                              statusTip="Créer un nouveau fichier",
                              triggered=self.newFile)
     self.exitAction = QAction('&Exit',
                               self,
                               shortcut="Ctrl+Q",
                               statusTip="Quitter l'application",
                               triggered=self.exitFile)
     self.copyAction = QAction('&Copy',
                               self,
                               shortcut="Ctrl+C",
                               statusTip="Copier",
                               triggered=self.textEdit.copy)
     self.pasteAction = QAction('&Paste',
                                self,
                                shortcut="Ctrl+V",
                                statusTip="Coller",
                                triggered=self.textEdit.paste)
     self.aboutAction = QAction('&About',
                                self,
                                statusTip="Infos à propos de l'éditeur",
                                triggered=self.aboutHelp)
示例#17
0
	def __init__(self,args,continuous):
		self.continuous = continuous
		gobject.GObject.__init__(self)
		#start by making our app
		self.app = QApplication(args)
		#make a window
		self.window = QMainWindow()
		#give the window a name
		self.window.setWindowTitle("BlatherQt")
		self.window.setMaximumSize(400,200)
		center = QWidget()
		self.window.setCentralWidget(center)

		layout = QVBoxLayout()
		center.setLayout(layout)
		#make a listen/stop button
		self.lsbutton = QPushButton("Listen")
		layout.addWidget(self.lsbutton)
		#make a continuous button
		self.ccheckbox = QCheckBox("Continuous Listen")
		layout.addWidget(self.ccheckbox)

		#connect the buttons
		self.lsbutton.clicked.connect(self.lsbutton_clicked)
		self.ccheckbox.clicked.connect(self.ccheckbox_clicked)

		#add a label to the UI to display the last command
		self.label = QLabel()
		layout.addWidget(self.label)

		#add the actions for quiting
		quit_action = QAction(self.window)
		quit_action.setShortcut('Ctrl+Q')
		quit_action.triggered.connect(self.accel_quit)
		self.window.addAction(quit_action)
示例#18
0
文件: QtUI.py 项目: rkycia/blather
    def __init__(self, args, continuous):
        self.continuous = continuous
        gobject.GObject.__init__(self)
        #start by making our app
        self.app = QApplication(args)
        #make a window
        self.window = QMainWindow()
        #give the window a name
        self.window.setWindowTitle("BlatherQt")
        self.window.setMaximumSize(400, 200)
        center = QWidget()
        self.window.setCentralWidget(center)

        layout = QVBoxLayout()
        center.setLayout(layout)
        #make a listen/stop button
        self.lsbutton = QPushButton("Listen")
        layout.addWidget(self.lsbutton)
        #make a continuous button
        self.ccheckbox = QCheckBox("Continuous Listen")
        layout.addWidget(self.ccheckbox)

        #connect the buttons
        self.lsbutton.clicked.connect(self.lsbutton_clicked)
        self.ccheckbox.clicked.connect(self.ccheckbox_clicked)

        #add a label to the UI to display the last command
        self.label = QLabel()
        layout.addWidget(self.label)

        #add the actions for quiting
        quit_action = QAction(self.window)
        quit_action.setShortcut('Ctrl+Q')
        quit_action.triggered.connect(self.accel_quit)
        self.window.addAction(quit_action)
示例#19
0
 def init_toolbar(self):
     self.save_btn = self.ui.toolBar.addAction(
         QIcon.fromTheme('document-save'), 
         self.tr('Save'), self.save,
     )
     self.close_btn = self.ui.toolBar.addAction(
         QIcon.fromTheme('window-close'), 
         self.tr('Close without saving'), 
         self.close,
     )
     self.ui.toolBar.addAction(
         QIcon.fromTheme('edit-delete'),
         self.tr('Remove note'), 
         self.delete,
     )
     self.ui.toolBar.addSeparator()
     for action in self.note_edit.get_format_actions():
         self.ui.toolBar.addAction(action)
     self.ui.toolBar.addSeparator()
     self.find_action = QAction(QIcon.fromTheme('edit-find'),
                                self.app.tr('Find'), self)
     self.find_action.setCheckable(True)
     self.find_action.triggered.connect(self.findbar.toggle_visible)
     self.ui.toolBar.addAction(self.find_action)
     self.ui.toolBar.addSeparator()
     self.pin = self.ui.toolBar.addAction(
         QIcon.fromTheme('edit-pin', QIcon.fromTheme('everpad-pin')),
         self.tr('Pin note'), self.mark_touched,
     )
     self.pin.setCheckable(True)
     self.pin.setChecked(self.note.pinnded)
示例#20
0
 def context_menu(self, pos, image_hash=None):
     """Show custom context menu"""
     menu = self.page.createStandardContextMenu()
     menu.clear()
     menu.addAction(self.page.action(QWebPage.Cut))
     menu.addAction(self.page.action(QWebPage.Copy))
     menu.addAction(self.page.action(QWebPage.Paste))
     paste_wo = self.page.action(QWebPage.PasteAndMatchStyle)
     paste_wo.setText(self.app.tr('Paste as Plain Text'))
     menu.addAction(paste_wo)
     if self._hovered_url:
         menu.addAction(self.page.action(QWebPage.CopyLinkToClipboard))
         change_link = QAction('Change link', self)
         change_link.triggered.connect(
             Slot()(partial(self._change_link, self.page.active_link)),
         )
         menu.addAction(change_link)
         remove_link = QAction('Remove link', self)
         remove_link.triggered.connect(
             self._remove_link,
         )
         menu.addAction(remove_link)
         self.page.active_link = None
     if self.page.active_image:
         res = self.parent.resource_edit.get_by_hash(self.page.active_image)
         self.page.active_image = None
         menu.addAction(
             self.app.tr('Image Preferences'),
             Slot()(partial(self._show_image_dialog, res)),
         )
     menu.addSeparator()
     menu.addAction(self.page.action(QWebPage.RemoveFormat))
     menu.addAction(self.page.action(QWebPage.SelectAll))
     menu.exec_(self.widget.mapToGlobal(pos))
示例#21
0
    def get_format_actions(self):
        check_action = QAction(
            self.app.tr('Insert Checkbox'), self,
        )
        check_action.triggered.connect(self._insert_check)
        link_action = QAction(
            self.app.tr('Insert Link'), self,
        )
        link_action.triggered.connect(self._insert_link)
        table_action = QAction(
            self.app.tr('Insert Table'), self,
        )
        table_action.triggered.connect(self._insert_table)
        image_action = QAction(
            self.app.tr('Insert Image'), self,
        )
        image_action.triggered.connect(self._insert_image)

        actions = [
            (QWebPage.ToggleBold,
                ['format-text-bold', 'everpad-text-bold']),
            (QWebPage.ToggleItalic,
                ['format-text-italic', 'everpad-text-italic']),
            (QWebPage.ToggleUnderline,
                ['format-text-underline', 'everpad-text-underline']),
            (QWebPage.ToggleStrikethrough,
                ['format-text-strikethrough', 'everpad-text-strikethrough']),
            (QWebPage.AlignCenter,
                ['format-justify-center', 'everpad-justify-center']),
            (QWebPage.AlignJustified,
                ['format-justify-fill', 'everpad-justify-fill']),
            (QWebPage.AlignLeft,
                ['format-justify-left', 'everpad-justify-left']),
            (QWebPage.AlignRight,
                ['format-justify-right', 'everpad-justify-right']),
            ]

        if self._enable_text_direction_support():
            actions += [
                (QWebPage.SetTextDirectionLeftToRight,
                    ['format-text-direction-ltr', 'everpad-text-direction-ltr']),
                (QWebPage.SetTextDirectionRightToLeft,
                    ['format-text-direction-rtl', 'everpad-text-direction-rtl']),
                ]

        actions += [
            (QWebPage.InsertUnorderedList,
                ['format-list-unordered', 'everpad-list-unordered']),
            (QWebPage.InsertOrderedList,
                ['format-list-ordered', 'everpad-list-ordered']),

            # Don't include 'checkbox' since it looks bad in some default themes
            (check_action, ['everpad-checkbox'], True),
            (table_action, ['insert-table', 'everpad-insert-table'], True),
            (link_action, ['insert-link'], True),
            (image_action, ['insert-image'], True),
            ]

        return map(lambda action: self._action_with_icon(*action), actions)
示例#22
0
 def testPythonStringAsQKeySequence(self):
     '''Passes a Python string to an argument expecting a QKeySequence.'''
     keyseq = py3k.unicode_('Ctrl+A')
     action = QAction(None)
     action.setShortcut(keyseq)
     shortcut = action.shortcut()
     self.assert_(isinstance(shortcut, QKeySequence))
     self.assertEqual(shortcut.toString(), keyseq)
    def popup(self,pos):
        menu = QMenu()

        saveRepAction = QAction(self)
        saveRepAction.setText('Save representation...')
        saveRepAction.triggered.connect(lambda: self.saveRep(self.indexAt(pos)))
        menu.addAction(saveRepAction)
        action = menu.exec_(self.mapToGlobal(pos))
示例#24
0
 def __init__(self):
   QAction.__init__(self, "Copy Path(s) to Clipboard", None)
   self.triggered.connect(self.getPythonSelection)
   hiero.core.events.registerInterest("kShowContextMenu/kTimeline", self.eventHandler)
   hiero.core.events.registerInterest("kShowContextMenu/kBin", self.eventHandler)
   hiero.core.events.registerInterest("kShowContextMenu/kSpreadsheet", self.eventHandler)
   self.setShortcut("Ctrl+Shift+Alt+C")
   self.setObjectName("foundry.menu.copypathstoclipboard")
示例#25
0
 def __init__(self):
   QAction.__init__(self, "Copy Python Selection", None)
   self.triggered.connect(self.getPythonSelection)
   hiero.core.events.registerInterest("kShowContextMenu/kTimeline", self.eventHandler)
   hiero.core.events.registerInterest("kShowContextMenu/kBin", self.eventHandler)
   hiero.core.events.registerInterest("kShowContextMenu/kSpreadsheet", self.eventHandler)
   self.setShortcut("Ctrl+Alt+C")
   self._selection = ()
示例#26
0
 def testPythonStringAsQKeySequence(self):
     '''Passes a Python string to an argument expecting a QKeySequence.'''
     keyseq = py3k.unicode_('Ctrl+A')
     action = QAction(None)
     action.setShortcut(keyseq)
     shortcut = action.shortcut()
     self.assert_(isinstance(shortcut, QKeySequence))
     self.assertEqual(shortcut.toString(), keyseq)
示例#27
0
 def __init__(self):
     QAction.__init__(self, "Set Poster Frame", None)
     self.triggered.connect(self.setPosterFrameForActiveSequence)
     hiero.core.events.registerInterest("kShowContextMenu/kViewer",
                                        self.eventHandler)
     self.setObjectName("foundry.viewer.setPosterFrame")
     self.setShortcut("Shift+P")
     self.currentViewer = None
 def addExitButton(self):
     """ Adds the Exit Button to the ToolBar """
     exitAction = QAction(self.getQIcon('exit.png'), 'Exit the Application', self)
     exitAction.setShortcut('Ctrl+Q')
     exitAction.setStatusTip("Exit the Application.")
     exitAction.triggered.connect(QtCore.QCoreApplication.instance().quit)
     
     self.addAction(exitAction)
示例#29
0
 def testSetShortcut(self):
     # Somehow an exception was leaking from the constructor
     # and appearing in setShortcut.
     o = QWidget()
     action = QAction('aaaa', o)
     shortcut = 'Ctrl+N'
     action.setShortcut(shortcut)
     s2 = action.shortcut()
     self.assertEqual(s2, shortcut)
示例#30
0
 def create_actions(self):
     """ Creates QAction object for binding event handlers.
     """
     self.start_action = QAction(
         "&打开 Listen 1", self, triggered=self.on_start)
     self.open_action = QAction(
         "&离线音乐文件夹", self, triggered=self.on_open)
     self.quit_action = QAction(
         "&退出", self, triggered=self.on_quit)
示例#31
0
 def testSetShortcut(self):
     # Somehow an exception was leaking from the constructor
     # and appearing in setShortcut.
     o = QWidget()
     action = QAction('aaaa', o)
     shortcut = 'Ctrl+N'
     action.setShortcut(shortcut)
     s2 = action.shortcut()
     self.assertEqual(s2, shortcut)
 def addNewTransactionButton(self):
     """ Adds the New Transaction Button to the ToolBar """
     newIcon = self.getQIcon('money.png')
     newTransactionAction = QAction(newIcon, 'New Transaction', self)
     newTransactionAction.setShortcut('Ctrl+N')
     newTransactionAction.setStatusTip("Create a New Transaction.")
     newTransactionAction.triggered.connect(self.newTransaction)
     
     self.addAction(newTransactionAction)
 def makeAction(self,title, method, icon = None):
   action = QAction(title,None)
   action.setIcon(QIcon(icon))
   
   # We do this magic, so that the title string from the action is used to trigger the version change
   def methodWrapper():
     method(title)
   
   action.triggered.connect( methodWrapper )
   return action     
示例#34
0
def titleStringTriggeredAction(title, method, icon = None):
  action = QAction(title,None)
  action.setIcon(QIcon(icon))
  
  # We do this magic, so that the title string from the action is used to set the status
  def methodWrapper():
    method(title)
  
  action.triggered.connect( methodWrapper )
  return action
示例#35
0
    def __LobbyListMenu( self, position ):
        lobby_menu      = QMenu()

        rm_from_lobby   = QAction( self )
        rm_from_lobby.setText( "Remove player from lobby" )
        rm_from_lobby.triggered.connect( self._RemoveFromLobbyListAction )

        lobby_menu.addAction( rm_from_lobby )

        lobby_menu.exec_( self.window.lobby_lst.viewport().mapToGlobal( position ) )
示例#36
0
def titleStringTriggeredAction(title, method, icon=None):
    action = QAction(title, None)
    action.setIcon(QIcon(icon))

    # We do this magic, so that the title string from the action is used to set the status
    def methodWrapper():
        method(title)

    action.triggered.connect(methodWrapper)
    return action
示例#37
0
 def __init__(self):
     QAction.__init__(self, "Get Python Selection", None)
     self.triggered.connect(self.getPythonSelection)
     hiero.core.events.registerInterest("kShowContextMenu/kTimeline",
                                        self.eventHandler)
     hiero.core.events.registerInterest("kShowContextMenu/kBin",
                                        self.eventHandler)
     hiero.core.events.registerInterest("kShowContextMenu/kSpreadsheet",
                                        self.eventHandler)
     self.setShortcut("Ctrl+Alt+C")
     self._selection = ()
示例#38
0
 def setupContextMenu(self, vobj, menu):
     """Set up the object's context menu in GUI (callback)."""
     for item in self._context_menu_mapping():
         if item.icon:
             icon = QIcon(os.path.join(ICONDIR, item.icon))
             action = QAction(icon, item.name, menu)
         else:
             action = QAction(item.name, menu)
         method = getattr(self, item.action)
         QObject.connect(action, SIGNAL("triggered()"), method)
         menu.addAction(action)
示例#39
0
 def _create_actions(self):
     self.save_to_new_action = QAction(
         "Save boxes to new cookie cutter...", self
     )
     self.choose_action = QAction(
         "Choose...", self, triggered=self.choose
     )
     self.clear_action = QAction(
         "Do not use a cookie cutter", self, triggered=self.clear
     )
     self.apply_current_action = QAction("Apply", self)
示例#40
0
 def __init__(self):
     QAction.__init__(self, "Copy Path(s) to Clipboard", None)
     self.triggered.connect(self.getPythonSelection)
     hiero.core.events.registerInterest("kShowContextMenu/kTimeline",
                                        self.eventHandler)
     hiero.core.events.registerInterest("kShowContextMenu/kBin",
                                        self.eventHandler)
     hiero.core.events.registerInterest("kShowContextMenu/kSpreadsheet",
                                        self.eventHandler)
     self.setShortcut("Ctrl+Shift+Alt+C")
     self.setObjectName("foundry.menu.copypathstoclipboard")
 def buildExistingTransferSection(self):
     """ Build existing Transfer Section """
     if self.toolbar.transaction.account is self.table_view.account:
         self.transferLabel = QLabel("Transferred {0}: {1}".format(self.getTransferDirection(), self.toolbar.transaction.transferAccount.name), self.toolbar)
     else:
         self.transferLabel = QLabel("Transferred {0}: {1}".format(self.getTransferDirection(), self.toolbar.transaction.account.name), self.toolbar)
     self.toolbar.addWidget(self.transferLabel)
     eraseIcon = self.toolbar.getQIcon('erase.png')
     removeTransferAction = QAction(eraseIcon, 'Remove Transfer', self.toolbar)
     removeTransferAction.setStatusTip("Remove Transfer.")
     removeTransferAction.triggered.connect(self.removeTransfer)
     self.toolbar.addAction(removeTransferAction)
示例#42
0
 def traverseForInit(arr, target):
     for item in arr[1:]:
         if isinstance(item, list):
             target.addMenu(ContextMenu(item, target))
         elif isinstance(item, basestring):
             target.addAction(QAction(target.tr(item), target))
         elif isinstance(item, tuple):
             title, data = item
             action = QAction(target.tr(title), target)
             action.setData(data)
             target.addAction(action)
         else:
             target.addSeparator()
    def on_show_debug_menu(self):
        self.debug_menu.clear()

        if self.is_master_cmd or self.power_user:
            power_user_mode = QAction('Power User Mode', self)
            power_user_mode.setCheckable(True)
            power_user_mode.setChecked(MTTSettings.value('powerUser'))
            power_user_mode.triggered.connect(self.__on_toggle_power_user)
            self.debug_menu.addAction(power_user_mode)
            self.is_master_cmd = False

            self.debug_menu.addSeparator()

        open_pref_folder_action = QAction('Open Preferences Folder', self)
        open_pref_folder_action.setStatusTip('Open MTT preference folder')
        open_pref_folder_action.triggered.connect(self.on_open_preference_folder)
        self.debug_menu.addAction(open_pref_folder_action)

        self.debug_menu.addSeparator()

        database_dump_csv = QAction('Dump Database as CSV', self)
        database_dump_csv.triggered.connect(self.view.model.database_dump_csv)
        self.debug_menu.addAction(database_dump_csv)

        database_dump_sql = QAction('Dump Database as SQL', self)
        database_dump_sql.triggered.connect(self.view.model.database_dump_sql)
        self.debug_menu.addAction(database_dump_sql)

        self.debug_menu.addSeparator()

        support_info = QMenu(self)
        support_info.setTitle('Supported Node Type')
        support_info.aboutToShow.connect(self.on_show_supported_type)
        self.debug_menu.addMenu(support_info)
示例#44
0
    def loadContextMenu(self, *args):

        menu = QMenu(self.w_tree)
        path = self.w_tree.currentItem().text(0)
        if os.path.isdir(path):
            dirPath = path
        else:
            dirPath = os.path.dirname(path)
        if os.path.exists(dirPath):
            menu.addAction(unicode("Open Folder", errors='replace'),
                           self.openFolder)
        menu.addAction(unicode("Copy Path", errors='replace'), self.copyPath)
        separator = QAction(self.w_tree)
        separator.setSeparator(True)
        menu.addAction(separator)
        menu.addAction(unicode("Replace Path", errors='replace'),
                       self.replacePath)
        separator = QAction(self.w_tree)
        separator.setSeparator(True)
        menu.addAction(separator)
        if self.unusedExists():
            menu.addAction(unicode("Remove Unused Files", errors='replace'),
                           self.removeUnused)
        pos = QCursor.pos()
        point = QtCore.QPoint(pos.x() + 10, pos.y())
        menu.exec_(point)
示例#45
0
    def updateFileMenu(self):
        """
        Updates the file menu dynamically, so that recent files can be shown.
        """
        self.menuFile.clear()
#        self.menuFile.addAction(self.actionNew)    # disable for now
        self.menuFile.addAction(self.actionOpen)
        self.menuFile.addAction(self.actionSave)
        self.menuFile.addAction(self.actionSave_as)
        self.menuFile.addAction(self.actionClose_Model)

        recentFiles = []
        for filename in self.recentFiles:
            if QFile.exists(filename):
                recentFiles.append(filename)

        if len(self.recentFiles) > 0:
            self.menuFile.addSeparator()
            for i, filename in enumerate(recentFiles):
                action = QAction("&%d %s" % (i + 1, QFileInfo(filename).fileName()), self)
                action.setData(filename)
                action.setStatusTip("Opens recent file %s" % QFileInfo(filename).fileName())
                action.setShortcut(QKeySequence(Qt.CTRL | (Qt.Key_1+i)))
                action.triggered.connect(self.load_model)
                #self.connect(action, SIGNAL("triggered()"), self.load_model)
                self.menuFile.addAction(action)

        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionQuit)
示例#46
0
 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     self.chat_widget = ChatWidget(self)
     self.setCentralWidget(self.chat_widget)
     # set up all actions
     self.chat_widget.message.connect(self.statusBar().showMessage)
     app_menu = self.menuBar().addMenu('&Application')
     self.connect_action = QAction('&Connect', self)
     self.connect_action.triggered.connect(self._connect)
     self.connect_action.setShortcut('Ctrl+C')
     app_menu.addAction(self.connect_action)
     app_menu.addSeparator()
     self.quit_server_action = QAction('Quit &server', self)
     self.quit_server_action.triggered.connect(self._quit_server)
     self.quit_server_action.setEnabled(False)
     self.quit_server_action.setShortcut('Ctrl+D')
     app_menu.addAction(self.quit_server_action)
     quit_action = QAction(
         self.style().standardIcon(QStyle.SP_DialogCloseButton), '&Quit',
         self)
     quit_action.triggered.connect(QApplication.instance().quit)
     quit_action.setShortcut('Ctrl+Q')
     app_menu.addAction(quit_action)
     # attempt to connect
     self._connect()
    def init_ui(self):
        # geometry is x offset, y offset, x width, y width
        self.setGeometry(150, 150, 640, 300)
        self.setWindowTitle(self.title)

        menu_bar = self.menuBar()
        file_menu = menu_bar.addMenu('&File')
        exitAction = QAction('E&xit', self)
        exitAction.setStatusTip('Exit the application.')
        exitAction.triggered.connect(self.handle_exit)
        file_menu.addAction(exitAction)

        main_layout_container = QWidget()
        main_layout = QBoxLayout(QBoxLayout.TopToBottom)

        image_layout = QBoxLayout(QBoxLayout.LeftToRight)
        image_layout.addStretch(1)
        self.image1 = QLabel()
        self.image1.setAlignment(Qt.AlignCenter)
        image_layout.addWidget(self.image1)

        image_layout.addWidget(QLabel("vs."))

        self.image2 = QLabel()
        self.image2.setAlignment(Qt.AlignCenter)
        image_layout.addWidget(self.image2)
        image_layout.addStretch(1)

        main_layout.addLayout(image_layout)
        main_layout.addStretch(1)

        button_layout = QBoxLayout(QBoxLayout.LeftToRight)
        button_layout.addStretch(1)
        self.yes_button = QPushButton("Yes")
        button_layout.addWidget(self.yes_button)
        self.yes_button.clicked.connect(self.handle_yes_pressed)

        self.no_button = QPushButton("No")
        button_layout.addWidget(self.no_button)
        self.no_button.clicked.connect(self.handle_no_pressed)
        button_layout.addStretch(1)
        main_layout.addLayout(button_layout)

        main_layout_container.setLayout(main_layout)

        self.image1_filepath = ""
        self.image2_filepath = ""

        self.load_more_images()
        self.setCentralWidget(main_layout_container)
示例#48
0
文件: main_window.py 项目: sl5net/a2
    def init_actions(self):
        self.actions = a = {}

        ##### File Menu #######################################################

        a['document-new'] = QAction("&New",
                                    self,
                                    shortcut=QKeySequence.New,
                                    statusTip="Create a new file.",
                                    triggered=self.action_new)

        a['document-open'] = QAction("&Open",
                                     self,
                                     shortcut=QKeySequence.Open,
                                     statusTip="Open an existing file.",
                                     triggered=self.action_open)

        a['document-save'] = QAction("&Save",
                                     self,
                                     shortcut=QKeySequence.Save,
                                     statusTip="Save the document to disk.",
                                     triggered=self.action_save)

        a['application-exit'] = QAction("E&xit",
                                        self,
                                        statusTip="Exit the application.",
                                        triggered=self.close)

        ##### Edit Menu #######################################################

        a['edit-cut'] = QAction("Cu&t",
                                self,
                                shortcut=QKeySequence.Cut,
                                triggered=self.editor.cut)

        a['edit-copy'] = QAction("&Copy",
                                 self,
                                 shortcut=QKeySequence.Copy,
                                 triggered=self.editor.copy)

        a['edit-paste'] = QAction("&Paste",
                                  self,
                                  shortcut=QKeySequence.Paste,
                                  triggered=self.editor.paste)

        a['edit-cut'].setEnabled(False)
        a['edit-copy'].setEnabled(False)

        self.editor.copyAvailable.connect(a['edit-cut'].setEnabled)
        self.editor.copyAvailable.connect(a['edit-copy'].setEnabled)

        ##### Tool Menu #######################################################

        # This is the fun part.
        a['addon-manager'] = QAction("&Add-ons",
                                     self,
                                     shortcut="Ctrl+Shift+A",
                                     statusTip="Display the Add-ons manager.",
                                     triggered=addons.show)
 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     self.view = QListView(self)
     self.view.setModel(CheckableFilesystemModel(self.view))
     self.view.activated.connect(self.openIndex)
     self.setCentralWidget(self.view)
     open_action = QAction(self.style().standardIcon(
         QStyle.SP_DialogOpenButton), 'Open', self)
     open_action.triggered.connect(self.askOpenDirectory)
     show_action = QAction('Show checked filenames', self)
     show_action.triggered.connect(self.showCheckedFiles)
     actions = self.addToolBar('Actions')
     actions.addAction(open_action)
     actions.addAction(show_action)
     self.openDirectory(os.path.expanduser('~'))
示例#50
0
 def _createAction(self, name, slot, shortcut=None, statusTip=None):
     
     action = QAction(name, self)
     action.triggered.connect(slot)
     
     if shortcut is not None:
         action.setShortcut(shortcut)
         
     if statusTip is not None:
         action.setStatusTip(statusTip)
         
     key = _stripEllipsis(name)
     self._actions[key] = action
     
     return action
示例#51
0
 def create_rev_action(self, repo, *revs):
     action = QAction(self.revs_menu)
     action.revs = revs
     action.setText(', '.join(str(rev) for rev in revs))
     action.setCheckable(True)
     action.setActionGroup(self.rev_actions)
     action.triggered.connect(self._revs_action_triggered)
     return action
示例#52
0
 def addDeleteWidgetAction(self, widget):
     """
     Add the delete action for the given widget in the delete widget menu.
     
     Parameter:
     
     - widget: The pysumo widget which will be deleted on action triggered.
     """
     action = QAction(widget)
     action.setText(widget.windowTitle())
     callback = partial(self._deleteWidget_, widget)
     action.triggered.connect(callback)
     if not self.menuDelete.isEnabled():
         self.menuDelete.setEnabled(True)
     self.menuDelete.addAction(action)
示例#53
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        layout = QVBoxLayout(self)
        horiz_layout = QHBoxLayout()
        self.conditional_legend_widget = EdgeWidget(self, True)
        self.conditional_legend_widget.setMinimumHeight(15)
        horiz_layout.addWidget(self.conditional_legend_widget)

        self.conditional_legend_label = QLabel("Conditional transition", self)
        horiz_layout.addWidget(self.conditional_legend_label)

        self.unconditional_legend_widget = EdgeWidget(self, False)
        self.unconditional_legend_widget.setMinimumHeight(15)
        horiz_layout.addWidget(self.unconditional_legend_widget)
        self.unconditional_legend_label = QLabel("Non-conditional transition",
                                                 self)
        horiz_layout.addWidget(self.unconditional_legend_label)

        layout.addLayout(horiz_layout)

        self.splitter = QSplitter(self)

        layout.addWidget(self.splitter)

        self.view = ClassyView(self.splitter)
        # layout.addWidget(self.view)
        self.scene = ClassyScene(self)
        self.view.setScene(self.scene)

        self._menu_bar = QMenuBar(self)
        self._menu = QMenu("&File")
        self._menu_bar.addMenu(self._menu)
        layout.setMenuBar(self._menu_bar)

        self.open_action = QAction("O&pen", self)
        self.exit_action = QAction("E&xit", self)
        self._menu.addAction(self.open_action)
        self._menu.addAction(self.exit_action)

        self.connect(self.open_action, SIGNAL("triggered()"), self.open_file)
        self.connect(self.exit_action, SIGNAL("triggered()"), self.close)

        self.settings = QSettings("CD Projekt RED", "TweakDB")

        self.log_window = QPlainTextEdit(self.splitter)
        self.splitter.setOrientation(Qt.Vertical)

        self.setWindowTitle("Classy nodes")
示例#54
0
 def __init__(self, app, hub, debug=False):
     BaseWebUI.__init__(self, "index.html", app, hub, debug)
     self.html = index.html
     
     self.agent = '%s v%s' % (USER_AGENT, '.'.join(str(v) for v in VERSION))
     log("Starting [%s]..." % self.agent, LEVEL_INFO)
     
     # Setup the system tray icon
     if sys.platform == 'darwin':
         tray_icon = 'evominer_16x16_mac.png'
     elif sys.platform == "win32":
         tray_icon = 'evominer_16x16.png'
     else:
         tray_icon = 'evominer_32x32_ubuntu.png'
     
     self.trayIcon = QSystemTrayIcon(self._getQIcon(tray_icon))
     self.trayIcon.setToolTip(tray_icon_tooltip)
     
     # Setup the tray icon context menu
     self.trayMenu = QMenu()
     
     self.showAppAction = QAction('&Show %s' % APP_NAME, self)
     f = self.showAppAction.font()
     f.setBold(True)
     self.showAppAction.setFont(f)
     self.trayMenu.addAction(self.showAppAction)
     
     
     self.aboutAction = QAction('&About...', self)
     self.trayMenu.addAction(self.aboutAction)
     
     self.trayMenu.addSeparator()
     self.exitAction = QAction('&Exit', self)
     self.trayMenu.addAction(self.exitAction)
     # Add menu to tray icon
     self.trayIcon.setContextMenu(self.trayMenu)
           
     # connect signals
     self.trayIcon.activated.connect(self._handleTrayIconActivate)
     self.exitAction.triggered.connect(self.handleExitAction)
     self.aboutAction.triggered.connect(self.handleAboutAction)
     self.showAppAction.triggered.connect(self._handleShowAppAction)
     self.app.aboutToQuit.connect(self._handleAboutToQuit)
     
     # Setup notification support
     self.system_tray_running_notified = False
     self.notifier = Notify(APP_NAME)
     self.trayIcon.show()
示例#55
0
    def createloginUsersContextMenu(self):
        '''添加登陆用户快捷菜单'''
        #pylint: disable=W0201
        self.killUserAct = QAction(self)
#        self.killUserAct.setText("kill user")
        
        self.messageUserAct = QAction(self)
#        self.messageUserAct.setText("message user")
        
        self.ui.loginUsers_tableView.addAction(self.killUserAct)
        self.ui.loginUsers_tableView.addAction(self.messageUserAct)
        
        QObject.connect(self.killUserAct, SIGNAL("activated()"), self, SLOT("killUser()"))
        QObject.connect(self.messageUserAct, SIGNAL("activated()"), self, SLOT("messageUser()"))
        
        self.ui.loginUsers_tableView.setContextMenuPolicy(Qt.ActionsContextMenu)
示例#56
0
文件: editor.py 项目: altawu/everpad
 def init_toolbar(self):
     self.save_btn = self.ui.toolBar.addAction(
         QIcon.fromTheme('document-save'), 
         self.tr('Save'), self.save,
     )
     self.ui.toolBar.addAction(
         QIcon.fromTheme('cancel'), 
         self.tr('Close without saving'), 
         self.close,
     )
     self.ui.toolBar.addAction(
         QIcon.fromTheme('edit-delete'),
         self.tr('Remove note'), 
         self.delete,
     )
     self.ui.toolBar.addSeparator()
     for action in self.note_edit.get_format_actions():
         self.ui.toolBar.addAction(action)
     self.ui.toolBar.addSeparator()
     self.find_action = QAction(QIcon.fromTheme('edit-find'),
                                self.app.tr('Find'), self)
     self.find_action.setCheckable(True)
     self.find_action.triggered.connect(self.findbar.toggle_visible)
     self.ui.toolBar.addAction(self.find_action)
     self.ui.toolBar.addSeparator()
     self.pin = self.ui.toolBar.addAction(
         QIcon.fromTheme('edit-pin', QIcon.fromTheme('everpad-pin')),
         self.tr('Pin note'), self.mark_touched,
     )
     self.pin.setCheckable(True)
     self.pin.setChecked(self.note.pinnded)
示例#57
0
文件: __init__.py 项目: ihjn/everpad
 def init_toolbar(self):
     self.save_btn = self.ui.toolBar.addAction(QIcon.fromTheme("document-save"), self.tr("Save"), self.save)
     self.close_btn = self.ui.toolBar.addAction(
         QIcon.fromTheme("window-close"), self.tr("Close without saving"), self.close
     )
     self.ui.toolBar.addAction(QIcon.fromTheme("edit-delete"), self.tr("Remove note"), self.delete)
     self.print_btn = self.ui.toolBar.addAction(
         QIcon.fromTheme("document-print"), self.tr("Print note"), self.note_edit.print_
     )
     self.email_btn = self.ui.toolBar.addAction(
         QIcon.fromTheme("mail-unread"), self.tr("Email note"), self.note_edit.email_note
     )
     self.email_btn = self.ui.toolBar.addAction(
         QIcon.fromTheme("emblem-shared"), self.tr("Share note"), self.share_note
     )
     self.ui.toolBar.addSeparator()
     for action in self.note_edit.get_format_actions():
         self.ui.toolBar.addAction(action)
     self.ui.toolBar.addSeparator()
     self.find_action = QAction(QIcon.fromTheme("edit-find"), self.tr("Find"), self)
     self.find_action.setCheckable(True)
     self.find_action.triggered.connect(self.findbar.toggle_visible)
     self.ui.toolBar.addAction(self.find_action)
     self.ui.toolBar.addSeparator()
     self.pin = self.ui.toolBar.addAction(
         QIcon.fromTheme("edit-pin", QIcon.fromTheme("everpad-pin")), self.tr("Pin note"), self.mark_touched
     )
     self.pin.setCheckable(True)
     self.pin.setChecked(self.note.pinnded)
示例#58
0
    def updateWindowMenu(self):
        #aboutToShow() does not do what Mark Summerfield thinks it does--at least in PySide.

        #Generate a list of actions to add to the Window menu.
        window_menu_actions = []
        for i, window in enumerate(MainWindow.instances):
            #The following line removes the "[*]" from the titleName.
            title_name = ''.join(window.titleName.split("[*]"))
            action_text = "%d. %s" % (i, title_name)
            new_action = QAction(action_text, self, triggered=self.raiseWindow)
            new_action.setData(window.titleName)
            window_menu_actions.append(new_action)

        for window in MainWindow.instances:
            window.menuWindow.clear()
            for new_action in window_menu_actions:
                window.menuWindow.addAction(new_action)