Esempio n. 1
0
    def setupUi(self):
        super(MainWindow, self).setupUi(self)

        self.search_box.shortcut = QShortcut(self.search_box)
        self.search_box.shortcut.setKey('Ctrl+F')

        self.output_devices_group = QActionGroup(self)
        self.input_devices_group = QActionGroup(self)
        self.alert_devices_group = QActionGroup(self)
        self.video_devices_group = QActionGroup(self)

        self.request_screen_action = QAction('Request screen', self, triggered=self._AH_RequestScreenActionTriggered)
        self.share_my_screen_action = QAction('Share my screen', self, triggered=self._AH_ShareMyScreenActionTriggered)
        self.screen_sharing_button.addAction(self.request_screen_action)
        self.screen_sharing_button.addAction(self.share_my_screen_action)

        # adjust search box height depending on theme as the value set in designer isn't suited for all themes
        search_box = self.search_box
        option = QStyleOptionFrameV2()
        search_box.initStyleOption(option)
        frame_width = search_box.style().pixelMetric(QStyle.PM_DefaultFrameWidth, option, search_box)
        if frame_width < 4:
            search_box.setMinimumHeight(20 + 2*frame_width)

        # adjust the combo boxes for themes with too much padding (like the default theme on Ubuntu 10.04)
        option = QStyleOptionComboBox()
        self.identity.initStyleOption(option)
        wide_padding = self.identity.style().subControlRect(QStyle.CC_ComboBox, option, QStyle.SC_ComboBoxEditField, self.identity).height() < 10
        self.identity.setStyleSheet("""QComboBox { padding: 0px 4px 0px 4px; }""" if wide_padding else "")
Esempio n. 2
0
    def __init__(self, parent):
        QtGui.QMainWindow.__init__(self, parent)

        self.workSpace = Workspace()

        #  get the status bar to show messages to the user
        self.statusbar = self.statusBar()
        self.statusbar.setSizeGripEnabled(False)

        # action groups of common actions for sound lab window
        self.play_record_actions        = QActionGroup(self)
        self.widgets_visibility_actions = QActionGroup(self)
        self.zoom_actions               = QActionGroup(self)
        self.tools_actions              = QActionGroup(self)
        self.save_images_actions        = QActionGroup(self)

        # play volume bar (disabled for now)
        self.volume_bar = QSlider(QtCore.Qt.Horizontal)
        self.volume_bar.setToolTip(self.tr(u"Volume bar for Play."))
        self.volume_bar.setMaximumWidth(100)
        self.volume_bar.setRange(0, 300)
        self.volume_bar.setValue(100)
        self.volume_bar.valueChanged.connect(self.change_volume)

        # text edit for the signal name on the toolbar
        self.signalNameLineEdit = QtGui.QLineEdit(self)
        self.signalNameLineEdit.setToolTip(self.tr(u"Signal name."))
        self.signalNameLineEdit.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum))

        self.signalPropertiesTextLabel = QtGui.QLabel(self)
        self.signalPropertiesTextLabel.setToolTip(self.tr(u"Signal properties."))
        self.signalPropertiesTextLabel.setAlignment(QtCore.Qt.AlignRight)
        self.signalPropertiesTextLabel.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                                                       QtGui.QSizePolicy.Minimum))
    def __init__(self, parent=None):
        super(ProjectSnappingAction, self).__init__(parent)
        self.setCheckable(True)

        self._currentAction = SnappingModeAction(Snapping.CurrentLayer, self)
        self._allAction = SnappingModeAction(Snapping.AllLayers, self)
        self._selectedAction = SnappingModeAction(Snapping.SelectedLayers,
                                                  self)

        self._snappingModeActionGroup = QActionGroup(self)
        self._snappingModeActionGroup.addAction(self._currentAction)
        self._snappingModeActionGroup.addAction(self._allAction)
        self._snappingModeActionGroup.addAction(self._selectedAction)

        self._vertexAction = ProjectSnappingTypeAction(Snapping.Vertex, self)
        self._segmentAction = ProjectSnappingTypeAction(Snapping.Segment, self)
        self._vertexSegmentAction = ProjectSnappingTypeAction(
            Snapping.VertexAndSegment, self)

        self._snappingTypeActionGroup = QActionGroup(self)
        self._snappingTypeActionGroup.addAction(self._vertexAction)
        self._snappingTypeActionGroup.addAction(self._segmentAction)
        self._snappingTypeActionGroup.addAction(self._vertexSegmentAction)

        self._pixelUnitsAction = ProjectSnappingUnitAction(
            Snapping.Pixels, self)
        self._layerUnitsAction = ProjectSnappingUnitAction(
            Snapping.LayerUnits, self)
        self._projectUnitsAction = ProjectSnappingUnitAction(
            Snapping.ProjectUnits, self)

        self._unitTypeActionGroup = QActionGroup(self)
        self._unitTypeActionGroup.addAction(self._pixelUnitsAction)
        self._unitTypeActionGroup.addAction(self._layerUnitsAction)
        self._unitTypeActionGroup.addAction(self._projectUnitsAction)

        self._toleranceAction = ProjectSnappingToleranceAction(parent)

        menu = ControlMenu(parent)
        menu.addActions(self._snappingModeActionGroup.actions())
        menu.addSeparator()
        menu.addActions(self._snappingTypeActionGroup.actions())
        menu.addSeparator()
        menu.addAction(self._toleranceAction)
        menu.addActions(self._unitTypeActionGroup.actions())
        self.setMenu(menu)

        self._refreshAction()

        # Make sure we catch changes in the main snapping dialog
        QgsProject.instance().snapSettingsChanged.connect(self._refreshAction)
Esempio n. 4
0
    def device_discovery(self, devs):
        group = QActionGroup(self._menu_devices, exclusive=True)

        for d in devs:
            node = QAction(d["name"], self._menu_devices, checkable=True)
            node.toggled.connect(self._inputdevice_selected)
            group.addAction(node)
            self._menu_devices.addAction(node)
            if (d["name"] == GuiConfig().get("input_device")):
                self._active_device = d["name"]
        if (len(self._active_device) == 0):
            self._active_device = self._menu_devices.actions()[0].text()

        device_config_mapping = GuiConfig().get("device_config_mapping")
        if (device_config_mapping):
            if (self._active_device in device_config_mapping.keys()):
                self._current_input_config = device_config_mapping[str(
                    self._active_device)]
            else:
                self._current_input_config = self._menu_mappings.actions(
                )[0].text()
        else:
            self._current_input_config = self._menu_mappings.actions()[0].text(
            )

        # Now we know what device to use and what mapping, trigger the events
        # to change the menus and start the input
        for c in self._menu_mappings.actions():
            c.setEnabled(True)
            if (c.text() == self._current_input_config):
                c.setChecked(True)

        for c in self._menu_devices.actions():
            if (c.text() == self._active_device):
                c.setChecked(True)
Esempio n. 5
0
 def setupMenuBar(self):
    self.fileMenu = self.menuBar().addMenu("&File")
    self.dateFormatMenu = self.fileMenu.addMenu("&Date format")
    self.dateFormatGroup = QActionGroup(self)
    for f in self.dateFormats:
       action = QAction(f, self, checkable=True,
               triggered=self.changeDateFormat)
       self.dateFormatGroup.addAction(action)
       self.dateFormatMenu.addAction(action)
       if f == self.currentDateFormat:
          action.setChecked(True)
            
    self.fileMenu.addAction(self.printAction)
    self.fileMenu.addAction(self.exitAction)
    self.cellMenu = self.menuBar().addMenu("&Cell")
    self.cellMenu.addAction(self.cell_addAction)
    self.cellMenu.addAction(self.cell_subAction)
    self.cellMenu.addAction(self.cell_mulAction)
    self.cellMenu.addAction(self.cell_divAction)
    self.cellMenu.addAction(self.cell_sumAction)
    self.cellMenu.addSeparator()
    self.cellMenu.addAction(self.colorAction)
    self.cellMenu.addAction(self.fontAction)
    self.menuBar().addSeparator()
    self.aboutMenu = self.menuBar().addMenu("&Help")
    self.aboutMenu.addAction(self.aboutSpreadSheet)
Esempio n. 6
0
    def change_layer_image_kind_menu(self, menu, lbox, selected_uuids, *args):
        current_kind = self.doc.prez_for_uuid(selected_uuids[0]).kind
        kind_menu = QMenu("Change Image Kind", menu)
        action_group = QActionGroup(menu, exclusive=True)
        actions = {}
        action_kinds = {}

        def _change_layers_image_kind(action, action_kinds=action_kinds):
            if not action.isChecked():
                # can't uncheck an image kind
                LOG.debug("Selected KIND action is not checked")
                return
            kind = action_kinds[action]
            return self.doc.change_layers_image_kind(selected_uuids, kind)

        for kind in [KIND.IMAGE, KIND.CONTOUR]:
            action = action_group.addAction(
                QAction(kind.name, menu, checkable=True))
            action_kinds[action] = kind
            action.setChecked(kind == current_kind)
            actions[action] = _change_layers_image_kind
            kind_menu.addAction(action)

        menu.addMenu(kind_menu)
        return actions
def setup_menu():
    u"""
    Add a submenu to a view menu.

    Add a submenu that lists the available extra classes to the view
    menu, creating that menu when neccessary
    """
    if extra_classes_list:
        try:
            mw.addon_view_menu
        except AttributeError:
            mw.addon_view_menu = QMenu(_(u"&View"), mw)
            mw.form.menubar.insertMenu(
                mw.form.menuTools.menuAction(), mw.addon_view_menu)
        mw.extra_class_submenu = QMenu(u"Mode (e&xtra class)", mw)
        mw.addon_view_menu.addMenu(mw.extra_class_submenu)
        action_group = QActionGroup(mw, exclusive=True)
        no_class_action = action_group.addAction(
            QAction('(none/standard)', mw, checkable=True))
        no_class_action.setChecked(True)
        mw.extra_class_submenu.addAction(no_class_action)
        mw.connect(no_class_action, SIGNAL("triggered()"),
                   lambda: set_extra_class(None))
        for ecd in extra_classes_list:
            nn_class_action = action_group.addAction(
                QAction(ecd['display'], mw, checkable=True))
            mw.extra_class_submenu.addAction(nn_class_action)
            mw.connect(nn_class_action, SIGNAL("triggered()"),
                       lambda ec=ecd['class']: set_extra_class(ec))
Esempio n. 8
0
    def configureToolBarActionsGroups(self):
        """
        :return:
        """
        sep = QAction(self)
        sep.setSeparator(True)

        # region Segmentation and Transformations actions
        segm_transf_actions = QActionGroup(self)
        segm_transf_actions_list = [
            self.actionDetection, self.actionTwo_Dimensional_Graphs,
            self.actionDelete_Selected_Elements, self.actionDeselect_Elements,
            self.actionAddElement, self.actionParameter_Measurement, sep
        ]

        for act in segm_transf_actions_list:
            act.setActionGroup(segm_transf_actions)

        # endregion

        # add to the customizable sound lab toolbar first than the default actions
        # addActionGroup(actionGroup, name)
        self.toolBar.addActionGroup(segm_transf_actions,
                                    u"Segments and Parameters")

        # apply the common sound lab window toolbar actions
        SoundLabWindow.configureToolBarActionsGroups(self)
Esempio n. 9
0
    def init_actions(self):
        """
        here we do extra setup for the window (mainly connect signals and slots)
        """

        # group action2D and action3D to make them mutually exclusive
        view_group = QActionGroup(self)
        view_group.addAction(self.action2D)
        view_group.addAction(self.action3D)
        # set 2D view by default
        self.action2D.setChecked(True)
        # connect view (re)set actions to functions
        self.action2D.toggled.connect(self.canvas.reset_view_2d)
        self.action3D.toggled.connect(self.canvas.reset_view_3d)
        self.actionReset.triggered.connect(self.canvas.reset_view)

        self.tool2d_explore_radio.toggled.connect(self.canvas.set_mode_explore)

        for radio2d in self.tab_2d.findChildren(QtGui.QRadioButton,
                                                QRegExp("tool2d.*")):
            self.tool2d_button_group.addButton(radio2d)
            radio2d.toggled.connect(self.tool2d_radio_toggled)

        # TODO: do the same for 3dtool buttons

        self.tool2d_operation_button.clicked.connect(self.perform_operation)

        self.tool3d_insert_shape_button.clicked.connect(
            self.open_insert_3d_shape_dialog)
Esempio n. 10
0
    def initGui(self):
    
        self.action = QAction(QIcon(":/plugins/EjdexplInt/icons/icon.png"),self.tr(u'Activate EjdExplorer tool'),self.iface.mainWindow())
        self.action.setWhatsThis(u"Activate EjdExplorer tool")
        self.action.triggered.connect(self.run)
    
        self.tbmenu = QMenu()

        self.ag1 = QActionGroup(self.tbmenu,exclusive=True)
        self.acPol  = self.ag1.addAction(QAction(QIcon(':/plugins/EjdexplInt/icons/Icons8-Ios7-Maps-Polygon.ico'),self.tr(u'Draw polygon'),self.tbmenu,checkable=True))
        self.acLin  = self.ag1.addAction(QAction(QIcon(':/plugins/EjdexplInt/icons/Icons8-Ios7-Maps-Polyline.ico'),self.tr(u'Draw line'),self.tbmenu,checkable=True))
        self.acPnt  = self.ag1.addAction(QAction(QIcon(':/plugins/EjdexplInt/icons/Icons8-Ios7-Maps-Geo-Fence.ico'),self.tr(u'Draw point'),self.tbmenu,checkable=True))
        self.acAlay = self.ag1.addAction(QAction(QIcon(':/plugins/EjdexplInt/icons/Icons8-Ios7-Maps-Layers.ico'),self.tr(u'Active selection'),self.tbmenu,checkable=True))
        self.acPobj = self.ag1.addAction(QAction(QIcon(':/plugins/EjdexplInt/icons/Icons8-Ios7-Maps-Quest.ico'),self.tr(u'Previous object'),self.tbmenu,checkable=True))
        self.tbmenu.addActions(self.ag1.actions());
        self.acPol.setChecked(self.config['searchtool']==u'polygon')
        self.acLin.setChecked(self.config['searchtool']==u'line')
        self.acPnt.setChecked(self.config['searchtool']==u'point')
        self.acAlay.setChecked(self.config['searchtool']==u'selection')
        self.acPobj.setChecked(self.config['searchtool']==u'search')

        self.tbmenu.addSeparator()

        self.ag2 = QActionGroup(self.tbmenu,exclusive=True)
        self.acSingle = self.ag2.addAction(QAction(self.tr(u'Use single mode'),self.tbmenu,checkable=True))
        self.acBulk = self.ag2.addAction(QAction(self.tr(u'Use bulk mode'),self.tbmenu,checkable=True))
        self.acMerge = self.ag2.addAction(QAction(self.tr(u'Use merge mode'),self.tbmenu,checkable=True))
        self.tbmenu.addActions(self.ag2.actions());
        self.acSingle.setChecked(self.config['tabchoice']==u'single')
        self.acBulk.setChecked(self.config['tabchoice']==u'bulk')
        self.acMerge.setChecked(self.config['tabchoice']==u'merge')

        if self.config['old_behavior'] == 0:
            self.tbmenu.addSeparator()
            self.acClear = QAction(self.tr(u'Clear'),self.tbmenu,checkable=False)
            self.acClear.triggered.connect(self.clearSearch)    
            self.tbmenu.addAction(self.acClear)

        self.toolButton = QToolButton()
        self.toolButton.addAction(self.action)
        self.toolButton.setDefaultAction(self.action)
        self.toolButton.setMenu(self.tbmenu)
        self.toolButton.setPopupMode(QToolButton.MenuButtonPopup)
        self.iface.addToolBarWidget(self.toolButton)
        self.iface.addPluginToMenu(self.tr(u'Activate EjdExplorer tool'), self.action)

        self.ag1.triggered.connect(self.drawChanged)    
Esempio n. 11
0
    def add_action(self,
                   icon_path,
                   text,
                   callback,
                   enabled_flag=True,
                   add_to_menu='toolbar',
                   add_to_toolbar=True,
                   status_tip=None,
                   whats_this=None,
                   isMenu=None,
                   checkable=None,
                   checked=None,
                   parent=None):

        if not parent:
            parent = self.iface.mainWindow()

        icon = QIcon(icon_path)
        if add_to_menu == 'toolbar':
            action = QAction(icon, text, parent)
        else:
            action = self.tools[add_to_menu].menu().addAction(text)
            action.setActionGroup(self.tools[add_to_menu].actionGroup)
            add_to_toolbar = False

        if checkable:
            action.setCheckable(True)
            if checked:
                action.setChecked(True)
            if callback:
                action.toggled.connect(callback)
        else:
            if callback:
                action.triggered.connect(callback)
        action.setEnabled(enabled_flag)

        if status_tip is not None:
            action.setStatusTip(status_tip)

        if whats_this is not None:
            action.setWhatsThis(whats_this)

        if add_to_toolbar:
            self.toolbar.addAction(action)

        if isMenu:
            newMenu = QMenu()
            action.setMenu(newMenu)
            newActionGroup = QActionGroup(newMenu)
            action.actionGroup = newActionGroup

        if add_to_menu == 'toolbar':
            self.iface.addPluginToMenu(self.menu, action)

        self.actions.append(action)

        return action
Esempio n. 12
0
 def create_menu(self, menu_name, menu_actions):
     """ Creates a menu.  Groups them so you can only select one at a time. """
     menu_action_group = QActionGroup(self)
     menu_action_group.setExclusive(True)
     menubar = self.menuBar()
     menu = menubar.addMenu(menu_name)
     for action in menu_actions:
         menu_action_group.addAction(action)
         menu.addAction(action)
Esempio n. 13
0
	def __init__(self, name, parent):
		"""
		parent: The parent of this toolbar.  Should be another toolbar
		""" 
		QToolBar.__init__(self,name, parent)
		self.setMovable(False)
		self.setWindowFlags(Qt.Tool | Qt.FramelessWindowHint | Qt.X11BypassWindowManagerHint)
		self.setAllowedAreas(Qt.NoToolBarArea)
		self.actiongroup = QActionGroup(self)
Esempio n. 14
0
 def __init__(self, parent=None):
     super(FilterSetWidget, self).__init__(parent)
     self.setupUi(self)
     self._filterSetActionGroup = QActionGroup(self)
     self._filterSetActionGroup.addAction(self.saveFilterSetAction)
     self._filterSetActionGroup.addAction(self.reloadFilterSetAction)
     self._filterSetActionGroup.addAction(self.deleteFilterSetAction)
     self._filterSetActionGroup.addAction(self.exportFilterSetAction)
     self._filterSetMenu = QMenu(self)
     self._filterSetMenu.addActions(self._filterSetActionGroup.actions())
     self.filterSetTool.setMenu(self._filterSetMenu)
     self.filterSetTool.setDefaultAction(self.saveFilterSetAction)
Esempio n. 15
0
File: qmap.py Progetto: s-chand/qmap
 def __init__(self, iface):
     self.iface = iface
     self.actions = []
     self.panels= []
     self.navtoolbar = self.iface.mapNavToolToolBar()
     self.mainwindow = self.iface.mainWindow()
     self.iface.projectRead.connect(self.projectOpened)
     self.iface.initializationCompleted.connect(self.setupUI)
     self.actionGroup = QActionGroup(self.mainwindow)
     self.actionGroup.setExclusive(True)
     self.menuGroup = QActionGroup(self.mainwindow)
     self.menuGroup.setExclusive(True)
             
     self.movetool = MoveTool(self.iface.mapCanvas(), [])
     self.report = PopDownReport(self.iface.messageBar())
     
     self.dialogprovider = DialogProvider(iface.mapCanvas(), iface)
     self.dialogprovider.accepted.connect(self.clearToolRubberBand)
     self.dialogprovider.rejected.connect(self.clearToolRubberBand)
     
     self.edittool = EditTool(self.iface.mapCanvas(),[])
     self.edittool.finished.connect(self.openForm)
Esempio n. 16
0
    def __init__(self, parent=None):
        super(ActionSettingsTool, self).__init__(parent)

        self._mapActionGroup = QActionGroup(self)
        self._noMapAction = self._addMapAction(MapAction.NoMapAction, 'No map action')
        self._zoomMapAction = self._addMapAction(MapAction.ZoomMap, 'Zoom map view')
        self._panMapAction = self._addMapAction(MapAction.PanMap, 'Pan map view')
        self._moveMapAction = self._addMapAction(MapAction.MoveMap, 'Move map view')
        self._moveMapAction.setChecked(True)

        self._filterActionGroup = QActionGroup(self)
        self._noFilterAction = self._addFilterAction(FilterAction.NoFilterAction, 'No filter action')
        self._includeFilterAction = self._addFilterAction(FilterAction.IncludeFilter, 'Add to filter')
        self._exclusiveFilterAction = self._addFilterAction(FilterAction.ExclusiveFilter, 'Exclusive filter')
        self._selectFilterAction = self._addFilterAction(FilterAction.SelectFilter, 'Add to selection')
        self._exclusiveSelectFilterAction = self._addFilterAction(
            FilterAction.ExclusiveSelectFilter, 'Exclusive selection')
        self._highlightFilterAction = self._addFilterAction(FilterAction.HighlightFilter, 'Add to highlight')
        self._exclusiveHighlightFilterAction = self._addFilterAction(
            FilterAction.ExclusiveHighlightFilter, 'Exclusive highlight')
        self._exclusiveHighlightFilterAction.setChecked(True)

        self._drawingActionGroup = QActionGroup(self)
        self._noDrawingAction = self._addDrawingAction(DrawingAction.NoDrawingAction, 'No drawing action')
        self._noDrawingAction.setChecked(True)
        self._loadDrawingsAction = self._addDrawingAction(DrawingAction.LoadDrawings, 'Load drawings')
        self._addDrawingsAction = self._addDrawingAction(DrawingAction.AddDrawings, 'Add drawings')

        self._settingsMenu = QMenu(self)
        self._settingsMenu.addActions(self._mapActionGroup.actions())
        self._settingsMenu.addSeparator()
        self._settingsMenu.addActions(self._filterActionGroup.actions())
        self._settingsMenu.addSeparator()
        self._settingsMenu.addActions(self._drawingActionGroup.actions())

        self._settingsAction = QAction(QIcon(':/plugins/ark/settings.svg'), "Action Settings", self)
        self._settingsAction.setMenu(self._settingsMenu)
        self.setDefaultAction(self._settingsAction)
        self.setPopupMode(QToolButton.InstantPopup)
Esempio n. 17
0
    def __init__(self, parent):
        super(XViewProfileToolBar, self).__init__(parent)

        # create custom properties
        self._editingEnabled = True
        self._viewWidget = None
        self._profileGroup = QActionGroup(self)

        # set the default options
        self.setIconSize(QSize(48, 48))
        self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
        self.setContextMenuPolicy(Qt.CustomContextMenu)

        # create connections
        self.actionTriggered.connect(self.handleActionTrigger)
        self.customContextMenuRequested.connect(self.showProfileMenu)
Esempio n. 18
0
    def load_action(self,
                    action,
                    toolbar_area=QtCore.Qt.TopToolBarArea,
                    toolbar_visible=True):
        category = action.category
        if category not in self._menus:
            # add an empty menu to the menu bar
            self._menus[category] = self._menu_bar.addMenu(category)
            self.add_toolbar(category, toolbar_area, toolbar_visible)
        self._toolbars[category].addAction(action)
        self._menus[category].addAction(action)

        group = action.group
        if group is not None:
            if group not in self._actiongroups:
                self._actiongroups[group] = QActionGroup(self.win)
            self._actiongroups[group].addAction(action)
Esempio n. 19
0
    def __createLanguageOptions(self):
        """Creates the language selection in the menubar.
        """
        self.langGroup = QActionGroup(self)
        self.langGroup.setExclusive(True)
        self.langGroup.triggered['QAction*'].connect(self.languageChanged)

        for key, name in self.languages.iteritems():
            action = QAction(self)
            action.setCheckable(True)
            action.setData(key)
            action.setText(name[0])
            action.setStatusTip(name[1])
            action.setActionGroup(self.langGroup)
            self.menuLanguage.addAction(action)
            if key == self.currentLanguage:
                action.setChecked(True)
Esempio n. 20
0
 def __init__(self, mainwindow):
     super(SessionMenu, self).__init__(mainwindow)
     app.translateUI(self)
     mgr = manager.get(mainwindow)
     ac = mgr.actionCollection
     ag = self._actionGroup = QActionGroup(self)
     ag.setExclusive(True)
     ag.addAction(ac.session_none)
     ag.triggered.connect(self.slotSessionsAction)
     self.addAction(ac.session_new)
     self.addAction(ac.session_save)
     self.addSeparator()
     self.addAction(ac.session_manage)
     self.addSeparator()
     self.addAction(ac.session_none)
     self.addSeparator()
     self.aboutToShow.connect(self.populate)
Esempio n. 21
0
 def __init__(self, mainwindow):
     self.actionCollection = ac = Actions()
     actioncollectionmanager.manager(mainwindow).addActionCollection(ac)
     m = self.language_menu = QMenu()
     g = self.language_group = QActionGroup(None)
     for name in sorted(ly.pitch.pitchInfo.keys()):
         a = m.addAction(name.title())
         a.setObjectName(name)
         a.setCheckable(True)
         g.addAction(a)
     qutil.addAccelerators(m.actions())
     ac.pitch_language.setMenu(m)
     m.aboutToShow.connect(self.setLanguageMenu)
     g.triggered.connect(self.changeLanguage)
     ac.pitch_rel2abs.triggered.connect(self.rel2abs)
     ac.pitch_abs2rel.triggered.connect(self.abs2rel)
     ac.pitch_transpose.triggered.connect(self.transpose)
     ac.pitch_modal_transpose.triggered.connect(self.modalTranspose)
Esempio n. 22
0
    def createActions(self, panel):
        self.music_document_select = DocumentChooserAction(panel)
        self.music_print = QAction(panel)
        self.music_zoom_in = QAction(panel)
        self.music_zoom_out = QAction(panel)
        self.music_zoom_original = QAction(panel)
        self.music_zoom_combo = ZoomerAction(panel)
        self.music_fit_width = QAction(panel, checkable=True)
        self.music_fit_height = QAction(panel, checkable=True)
        self.music_fit_both = QAction(panel, checkable=True)
        self._column_mode = ag = QActionGroup(panel)
        self.music_single_pages = QAction(ag, checkable=True)
        self.music_two_pages_first_right = QAction(ag, checkable=True)
        self.music_two_pages_first_left = QAction(ag, checkable=True)
        self.music_maximize = QAction(panel)
        self.music_jump_to_cursor = QAction(panel)
        self.music_sync_cursor = QAction(panel, checkable=True)
        self.music_copy_image = QAction(panel)
        self.music_pager = PagerAction(panel)
        self.music_next_page = QAction(panel)
        self.music_prev_page = QAction(panel)
        self.music_reload = QAction(panel)

        self.music_print.setIcon(icons.get('document-print'))
        self.music_zoom_in.setIcon(icons.get('zoom-in'))
        self.music_zoom_out.setIcon(icons.get('zoom-out'))
        self.music_zoom_original.setIcon(icons.get('zoom-original'))
        self.music_fit_width.setIcon(icons.get('zoom-fit-width'))
        self.music_fit_height.setIcon(icons.get('zoom-fit-height'))
        self.music_fit_both.setIcon(icons.get('zoom-fit-best'))
        self.music_maximize.setIcon(icons.get('view-fullscreen'))
        self.music_jump_to_cursor.setIcon(icons.get('go-jump'))
        self.music_copy_image.setIcon(icons.get('edit-copy'))
        self.music_next_page.setIcon(icons.get('go-next'))
        self.music_prev_page.setIcon(icons.get('go-previous'))
        
        self.music_document_select.setShortcut(QKeySequence(Qt.SHIFT | Qt.CTRL | Qt.Key_O))
        self.music_print.setShortcuts(QKeySequence.Print)
        self.music_zoom_in.setShortcuts(QKeySequence.ZoomIn)
        self.music_zoom_out.setShortcuts(QKeySequence.ZoomOut)
        self.music_jump_to_cursor.setShortcut(QKeySequence(Qt.CTRL | Qt.Key_J))
        self.music_copy_image.setShortcut(QKeySequence(Qt.SHIFT | Qt.CTRL | Qt.Key_C))
        self.music_reload.setShortcut(QKeySequence(Qt.Key_F5))
Esempio n. 23
0
    def __init__(self, parent=None):
        QPlainTextEdit.__init__(self, parent)
        self.setMaximumBlockCount(1000)

        self.group = QActionGroup(self)
        self.actions = [
            QAction(log_lvl, self.group)
            for log_lvl in ["Debug", "Info", "Warning", "Error", "Critical"]
        ]

        for action in self.actions:
            action.setCheckable(True)
            action.triggered.connect(self.on_log_filter)
        self.actions[0].setChecked(True)

        self.customContextMenuRequested.connect(
            self.on_custom_context_menu_requested)

        self.log_lvl = log_levels["DEBUG"]
Esempio n. 24
0
    def __setupUi(self):
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        # Scroll area for the contents.
        self.__scrollArea = \
                _ToolBoxScrollArea(self, objectName="toolbox-scroll-area")

        self.__scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.__scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.__scrollArea.setSizePolicy(QSizePolicy.MinimumExpanding,
                                        QSizePolicy.MinimumExpanding)
        self.__scrollArea.setFrameStyle(QScrollArea.NoFrame)
        self.__scrollArea.setWidgetResizable(True)

        # A widget with all of the contents.
        # The tabs/contents are placed in the layout inside this widget
        self.__contents = QWidget(self.__scrollArea,
                                  objectName="toolbox-contents")

        # The layout where all the tab/pages are placed
        self.__contentsLayout = QVBoxLayout()
        self.__contentsLayout.setContentsMargins(0, 0, 0, 0)
        self.__contentsLayout.setSizeConstraint(QVBoxLayout.SetMinAndMaxSize)
        self.__contentsLayout.setSpacing(0)

        self.__contents.setLayout(self.__contentsLayout)

        self.__scrollArea.setWidget(self.__contents)

        layout.addWidget(self.__scrollArea)

        self.setLayout(layout)
        self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding)

        self.__tabActionGroup = \
                QActionGroup(self, objectName="toolbox-tab-action-group")

        self.__tabActionGroup.setExclusive(self.__exclusive)

        self.__actionMapper = QSignalMapper(self)
        self.__actionMapper.mapped[QObject].connect(self.__onTabActionToogled)
Esempio n. 25
0
def add_menu_item(path, text, func, keys=None, checkable=False, checked=False):
    action = QAction(text, mw)

    if keys:
        action.setShortcut(QKeySequence(keys))

    if checkable:
        action.setCheckable(checkable)
        action.toggled.connect(func)
        if not hasattr(mw, 'action_groups'):
            mw.action_groups = {}
        if path not in mw.action_groups:
            mw.action_groups[path] = QActionGroup(None)
        mw.action_groups[path].addAction(action)
        action.setChecked(checked)
    else:
        action.triggered.connect(func)

    add_menu(path)
    mw.custom_menus[path].addAction(action)
    def setActionsExclusive(self):

        # Build an action list from QGIS navigation toolbar
        actionList = self.iface.mapNavToolToolBar().actions()

        # Add actions from QGIS attributes toolbar (handling QWidgetActions)
        tmpActionList = self.iface.attributesToolBar().actions()
        for action in tmpActionList:
            if isinstance(action, QWidgetAction):
                actionList.extend( action.defaultWidget().actions() )
            else:
                actionList.append( action )
        # ... add other toolbars' action lists...

        # Build a group with actions from actionList and add your own action
        group = QActionGroup( self.iface.mainWindow() )
        group.setExclusive(True)
        for action in actionList:
            group.addAction( action )
        group.addAction( self.identifyParcelleAction )
Esempio n. 27
0
    def on_classifyBtn_clicked(self):
        """
        Slot documentation goes here.
        """
        # TODO: not implemented yet
        #raise NotImplementedError
        if self.showGroupBtn.isChecked():
            self.showGroupBtn.setChecked(False)
            self.on_showGroupBtn_clicked()
        if self.classifyMenu is None:
            self.classifyMenu = QMenu(self)
            subMenu = QMenu(self)
            subMenu.setTitle(u'地区板块')
            self.classifyMenuGroup = QActionGroup(self)
            for key in myGlobal.area2ids:
                if len(key) != 0:
                    action = MyAction(key, myGlobal.area2ids[key],
                                      self.changeIds, self)
                    subMenu.addAction(action)
                    self.classifyMenuGroup.addAction(action)
            self.classifyMenu.addMenu(subMenu)
            subMenu = QMenu(self)
            subMenu.setTitle(u'行业板块')
            for key in myGlobal.industry2ids:
                if len(key) != 0:
                    action = MyAction(key, myGlobal.industry2ids[key],
                                      self.changeIds, self)
                    subMenu.addAction(action)
                    self.classifyMenuGroup.addAction(action)
            self.classifyMenu.addMenu(subMenu)
            subMenu = MyMenu(u'向上版块', 'FLAG_UP', self, self.classifyMenuGroup)
            self.classifyMenu.addMenu(subMenu)
            subMenu = MyMenu(u'向下版块', 'FLAG_DOWN', self,
                             self.classifyMenuGroup)
            self.classifyMenu.addMenu(subMenu)

        self.classifyBtn.setChecked(True)
        pos = QPoint()
        pos.setX(0)
        pos.setY(-self.classifyMenu.sizeHint().height())
        self.classifyMenu.exec_(self.classifyBtn.mapToGlobal(pos))
Esempio n. 28
0
 def loadPlugins(self):
     sys.path.append(os.curdir + os.sep + "plugins")
     plugins = QActionGroup(self)
     for s in os.listdir("plugins"):
         # TODO: check all errors
         if s.endswith(".py"):
             plugin = __import__(s[:-3])
             if plugin == "__init__":
                 continue
             if "pluginMain" in dir(plugin):
                 pluginClass = plugin.pluginMain()
                 name = pluginClass.GetName()
                 action = QAction(name, self)
                 action.setCheckable(False)
                 QObject.connect(action, SIGNAL("triggered()"),
                                 self.GenerateRequests)
                 plugins.addAction(action)
                 self.ui.menuGenerators.addAction(action)
                 self.generators[action] = pluginClass()
             else:
                 print("pluginMain not found in " + s)
Esempio n. 29
0
 def __init__( self, parent = None ):
     super(XSplitButton, self).__init__( parent )
     
     # define custom properties
     self._actionGroup   = QActionGroup(self)
     self._padding       = 5
     self._cornerRadius  = 10
     #self._currentAction = None
     self._checkable     = True
     
     # set default properties
     layout = QBoxLayout(QBoxLayout.LeftToRight)
     layout.setContentsMargins(0, 0, 0, 0)
     layout.setSpacing(0)
     self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
     self.setLayout(layout)
     self.clear()
     
     # create connections
     self._actionGroup.hovered.connect(self.emitHovered)
     self._actionGroup.triggered.connect(self.emitTriggered)
Esempio n. 30
0
 def _buildMenu(self):
     self.framelessCheck = QtGui.QAction("Frameless Window",
                                         self,
                                         checkable=True)
     self.connect(self.framelessCheck, SIGNAL("triggered()"),
                  self.trayIcon.changeFrameless)
     self.addAction(self.framelessCheck)
     self.addSeparator()
     self.requestCheck = QtGui.QAction("Show status request notifications",
                                       self,
                                       checkable=True)
     self.requestCheck.setChecked(True)
     self.addAction(self.requestCheck)
     self.connect(self.requestCheck, SIGNAL("triggered()"),
                  self.trayIcon.switchRequest)
     self.alarmCheck = QtGui.QAction("Show alarm notifications",
                                     self,
                                     checkable=True)
     self.alarmCheck.setChecked(True)
     self.connect(self.alarmCheck, SIGNAL("triggered()"),
                  self.trayIcon.switchAlarm)
     self.addAction(self.alarmCheck)
     distanceMenu = self.addMenu("Alarm Distance")
     self.distanceGroup = QActionGroup(self)
     for i in range(0, 6):
         action = QAction("{0} Jumps".format(i), None, checkable=True)
         if i == 0:
             action.setChecked(True)
         action.alarmDistance = i
         self.connect(action, SIGNAL("triggered()"),
                      self.changeAlarmDistance)
         self.distanceGroup.addAction(action)
         distanceMenu.addAction(action)
     self.addMenu(distanceMenu)
     self.addSeparator()
     self.quitAction = QAction("Quit", self)
     self.connect(self.quitAction, SIGNAL("triggered()"),
                  self.trayIcon.quit)
     self.addAction(self.quitAction)