Beispiel #1
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()
Beispiel #2
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 )
Beispiel #3
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)
Beispiel #4
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))
    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)
Beispiel #6
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)
Beispiel #7
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)
Beispiel #8
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)
Beispiel #9
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()
Beispiel #10
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)
Beispiel #11
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)
Beispiel #12
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)
Beispiel #13
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        #        self.setObjectName("MainWindow")
        self.resize(731, 475)
        centralwidget = QWidget(self)
        #        centralwidget.setObjectName("centralwidget")
        gridLayout = QGridLayout(centralwidget)
        #        gridLayout.setObjectName("gridLayout")
        # textEdit needs to be a class variable.
        self.textEdit = QTextEdit(centralwidget)
        #        self.textEdit.setObjectName("textEdit")
        gridLayout.addWidget(self.textEdit, 0, 0, 1, 1)
        self.setCentralWidget(centralwidget)
        menubar = QMenuBar(self)
        menubar.setGeometry(QRect(0, 0, 731, 29))
        #        menubar.setObjectName("menubar")
        menu_File = QMenu(menubar)
        #        menu_File.setObjectName("menu_File")
        self.setMenuBar(menubar)
        statusbar = QStatusBar(self)
        #        statusbar.setObjectName("statusbar")
        self.setStatusBar(statusbar)
        actionShow_GPL = QAction(self)
        #        actionShow_GPL.setObjectName("actionShow_GPL")
        actionShow_GPL.triggered.connect(self.showGPL)
        action_About = QAction(self)
        #        action_About.setObjectName("action_About")
        action_About.triggered.connect(self.about)
        iconToolBar = self.addToolBar("iconBar.png")
        #------------------------------------------------------
        # Add icons to appear in tool bar - step 1
        actionShow_GPL.setIcon(QIcon(":/showgpl.png"))
        action_About.setIcon(QIcon(":/about.png"))
        action_Close = QAction(self)
        action_Close.setCheckable(False)
        action_Close.setObjectName("action_Close")
        action_Close.setIcon(QIcon(":/quit.png"))
        #------------------------------------------------------
        # Show a tip on the Status Bar - step 2
        actionShow_GPL.setStatusTip("Show GPL Licence")
        action_About.setStatusTip("Pop up the About dialog.")
        action_Close.setStatusTip("Close the program.")
        #------------------------------------------------------
        menu_File.addAction(actionShow_GPL)
        menu_File.addAction(action_About)
        menu_File.addAction(action_Close)
        menubar.addAction(menu_File.menuAction())

        iconToolBar.addAction(actionShow_GPL)
        iconToolBar.addAction(action_About)
        iconToolBar.addAction(action_Close)
        action_Close.triggered.connect(self.close)
Beispiel #14
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()
Beispiel #15
0
    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('~'))
 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()
Beispiel #18
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")
    def contextMenuEvent(self, event):
        super(QuotationReportTable, self).contextMenuEvent(event)

        row = self.indexAt(self.parent().mapToParent(event.pos())).row()
        quotationNo = self.model().index(self.selectedIndexes()[-1].row(),
                                         2).data()
        viewQuotatedItemAction = QAction('View Items', self)
        viewQuotatedItemAction.triggered.connect(
            lambda: self.parent().viewItems(quotationNo))

        cancelAction = _QtGui.QAction('Cancel Quotation', self)
        cancelAction.triggered.connect(self._cancelPO)

        self.menu.addAction(viewQuotatedItemAction)

        quotationNo = self.model().index(self.selectedIndexes()[-1].row(),
                                         2).data()
        quotationDetails = self.parent()._manager.getQuotationDetailsInfo(
            quotationNo)

        createPdfAction = _QtGui.QAction('Create PDF', self)
        createPdfAction.triggered.connect(
            lambda: self.parent().createPDF(quotationNo))

        exportAction = _QtGui.QAction('Export to Excel', self)
        exportAction.triggered.connect(self.parent().exportToExcel)

        if not quotationDetails.cancelReason:
            self.menu.addAction(cancelAction)
        self.menu.addAction(createPdfAction)
        self.menu.addAction(exportAction)
    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)
Beispiel #21
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)
Beispiel #22
0
 def updateGotoMenu(self):
     self.gotoActions.goBackAction.setEnabled(False)
     menu = self.gotoMenu
     menu.clear()
     Lib.addActions(self.gotoMenu, self.gotoActions.forMenu())
     if self.state.gotoEids and bool(self.state.model):
         eids = collections.deque(maxlen=MAX_DYNAMIC_ACTIONS)
         for eid in self.state.gotoEids:
             if self.state.model.hasEntry(eid):
                 eids.append(eid)
                 if len(eids) == MAX_DYNAMIC_ACTIONS:
                     break
         accels = collections.deque("123456789DEGHJKKMQTUVWXZY")
         self.state.gotoEids = eids
         currentEid = self.state.viewAllPanel.view.selectedEid
         eids = [eid for eid in eids if eid != currentEid]
         for index, eid in enumerate(eids, 1):
             entry = self.state.model.entry(eid)
             term = Lib.elide(entry.term)
             if accels:
                 term = "&{} {}".format(accels.popleft(), term)
             if index == 1:
                 action = self.gotoActions.goBackAction
                 action.setEnabled(True)
                 action.setText(term)
                 action.triggered.disconnect()
             else:
                 action = QAction(QIcon(":/go-back.svg"), term, menu)
             action.triggered.connect(
                 lambda eid=eid: self.gotoActions.gotoEid(eid))
             menu.addAction(action)
Beispiel #23
0
    def Menu(self):
        #this creates an action exit, a shortcut and status tip
        exitAction = QAction(QIcon('icons/exit.png'), '&Exit', self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.setStatusTip('Exit application')
        exitAction.triggered.connect(self.close)

        openFile = QAction(QIcon('icons/open.png'), '&Open', self)
        openFile.setShortcut('Ctrl+O')
        openFile.setStatusTip('Open new File')
        openFile.triggered.connect(self.browse)

        runAction = QAction(QIcon('icons/run.png'), '&Run', self)
        runAction.setShortcut('Ctrl+R')
        runAction.setStatusTip('Run Mars')
        runAction.triggered.connect(self.run_event)
 def testSignal(self):
     o = QWidget()
     act = QAction(o)
     self._called = False
     act.triggered.connect(self._cb)
     act.trigger()
     self.assert_(self._called)
Beispiel #25
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)
Beispiel #26
0
    def popup_menu(self, position):

        selected_row = self.view.rowAt(position.y())

        if selected_row >= 0 and self._used_categories and len(
                self._used_categories) > 1:
            category_menu = QMenu(_("Categories"))
            selected_doc = self.model.object_at(selected_row)

            category_actions = []
            for category in self._used_categories:
                a = QAction(category.full_name, category_menu)
                a.setData(category)

                a.setEnabled(selected_doc.document_category_id !=
                             category.document_category_id)

                category_menu.addAction(a)
                category_actions.append(a)

            action = category_menu.exec_(QCursor.pos())

            if action:
                new_category = action.data()

                if selected_doc.document_category_id != new_category.document_category_id:
                    selected_doc.document_category_id = new_category.document_category_id
                    self.model.signal_object_change(selected_doc)
Beispiel #27
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)
Beispiel #28
0
 def setupContextMenu(self, vobj, menu):  # pylint: disable=no-self-use
     """Setup the context menu associated to the object in tree view
     (callback)"""
     icon = QIcon(os.path.join(WBDIR, "icons", "Render.svg"))
     action1 = QAction(icon, "Render", menu)
     QObject.connect(action1, SIGNAL("triggered()"), self.render)
     menu.addAction(action1)
Beispiel #29
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)
    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