def __init__(self, section_id, iface_canvas): QToolBar.__init__(self) self.__iface_canvas = iface_canvas self.__section_id = section_id icon = lambda name: QIcon(os.path.join(os.path.dirname(__file__), name)) self.addAction('axis').triggered.connect(self.__add_axis) self.addAction(icon('add_layer.svg'), 'add projected layer').triggered.connect(self.__add_layer) self.selectLineAction = self.addAction(icon('select_line.svg'), 'select line') self.selectLineAction.setCheckable(True) self.selectLineAction.triggered.connect(self.__set_section_line) self.buffer_width = QLineEdit("100") self.buffer_width.setMaximumWidth(50) self.addWidget(QLabel("Width:")) self.addWidget(self.buffer_width) self.z_autoscale = self.addAction(icon('autoscale.svg'), 'autoscale') self.z_autoscale.triggered.connect(self.z_autoscale_clicked.emit) self.__tool = None self.__old_tool = None self.__map_tool_changed(iface_canvas.mapTool()) iface_canvas.mapToolSet.connect(self.__map_tool_changed)
def __init__(self, parent=None): """ Initializes the class. :param parent: Widget parent. :type parent: QObject """ LOGGER.debug("> Initializing '{0}()' class.".format(self.__class__.__name__)) QToolBar.__init__(self, parent) # --- Setting class attributes. --- self.__container = parent self.__settings = self.__container.settings self.__layoutsActiveLabelsCollection = None self.__customLayoutsMenu = None self.__miscellaneousMenu = None self.__userLayouts = (umbra.managers.layoutsManager.Layout(name="1", identity="one", shortcut=Qt.Key_1), umbra.managers.layoutsManager.Layout(name="2", identity="two", shortcut=Qt.Key_2), umbra.managers.layoutsManager.Layout(name="3", identity="three", shortcut=Qt.Key_3), umbra.managers.layoutsManager.Layout(name="4", identity="four", shortcut=Qt.Key_4), umbra.managers.layoutsManager.Layout(name="5", identity="five", shortcut=Qt.Key_5)) Application_QToolBar.__initializeUi(self)
def __init__(self, manager, orientation, window): QToolBar.__init__(self, window) assert (manager) self.manager = manager self.uniqueId = 0 self.__dockToButton = {} self.__buttonToDock = {} self.__buttonToAction = {} self.toggleViewAction().setEnabled(False) self.toggleViewAction().setVisible(False) self.textAlwaysVisible = True self.setMovable(False) self.aToggleExclusive = QAction(self) self.aToggleExclusive.setCheckable(True) self.aToggleExclusive.setChecked(True) self.aToggleExclusive.setIcon(Icons.exclusive) self.aToggleExclusive.setText("%s exclusive" % self.windowTitle()) self.aToggleExclusive.toggled.connect(self.__setExclusive) self.addAction(self.aToggleExclusive) self.setIconSize(QSize(16, 16)) self.setOrientation(orientation)
def __init__(self, window, qsci): QToolBar.__init__(self) self.qsci = qsci self.actions_dict = {'action_new':("document-new", "New", self._new_file), 'action_open':("document-open", "Open", self._open_file), 'action_save':("document-save", "Save", self._save_file), 'action_save_as':("document-save-as", "Save As", self._saveas_file), 'action_cut':("edit-cut", "Cut", SLOT("cut ()")), 'action_copy':("edit-copy", "Copy", SLOT("copy ()")), 'action_paste':("edit-paste", "Paste", SLOT("paste ()")), 'action_undo':("edit-undo", "Undo", SLOT("undo ()")), 'action_redo':("edit-redo", "Redo", SLOT("redo ()")), 'action_execute':("edit-Execute", "Execute", self._execute)} self._action_names = {} for action in self.actions_dict: self.action = QAction(window) self.action.setIcon(QIcon.fromTheme(self.actions_dict[action][0])) self._action_names[action] = self.action self.action.setIconText(QApplication.translate("MainWindow", self.actions_dict[action][1], None, QApplication.UnicodeUTF8)) self.addAction(self.action) self.addSeparator() if action in ('action_new', 'action_open', 'action_save', 'action_save_as', 'action_execute'): QObject.connect(self.action, SIGNAL("triggered()"), self.actions_dict[action][2]) else: QObject.connect(self.action, SIGNAL("triggered()"), qsci, self.actions_dict[action][2]) QObject.connect(self.qsci, SIGNAL("textChanged()"), self._enable_save_btn)
def __init__(self): QToolBar.__init__(self, "PlotTools") self.setObjectName("PlotToolBar") self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.__x_min, self.__x_min_action = self.addScaler("x_min", "X Minimum", spinner_type=CTime, select_min_time_value=True) self.__x_max, self.__x_max_action = self.addScaler("x_max", "X Maximum", spinner_type=CTime) self.__y_min, self.__y_min_action = self.addScaler("y_min", "Y Minimum", spinner_type=float, select_min_time_value=True) self.__y_max, self.__y_max_action = self.addScaler("y_max", "Y Maximum", spinner_type=float) self.__report_step_widget = ReportStepWidget() self.__report_step_widget.reportStepTimeSelected.connect(self.reportStepChanged) self.__report_step_widget.setFontSize(PlotToolBar.FONT_SIZE) self.__report_step_widget_action = self.addWidget(self.__report_step_widget) self.addSeparator() export_action = self.addAction("Export") export_action.setText("Export Plot") export_action.setIcon(util.resourceIcon("ide/table_export")) w = self.widgetForAction(export_action) font = w.font() font.setPointSize(PlotToolBar.FONT_SIZE) w.setFont(font) export_action.triggered.connect(self.exportClicked)
def __init__(self, mainWindow): QToolBar.__init__(self) self.mainWindow = mainWindow self.doc = mainWindow.tabs.getCurrentWidget() self.Items() self.Layout() self.Signals()
def __init__(self, manager, orientation, window): QToolBar.__init__(self, window) assert(manager) self.manager = manager self.uniqueId = 0 self.__dockToButton = {} self.__buttonToDock = {} self.__buttonToAction = {} self.toggleViewAction().setEnabled(False) self.toggleViewAction().setVisible(False) self.textAlwaysVisible = True self.setMovable(False) self.aToggleExclusive = QAction(self) self.aToggleExclusive.setCheckable(True) self.aToggleExclusive.setChecked(True) self.aToggleExclusive.setIcon(Icons.exclusive) self.aToggleExclusive.setText("%s exclusive" % self.windowTitle()) self.aToggleExclusive.toggled.connect(self.__setExclusive) self.addAction(self.aToggleExclusive) self.setIconSize(QSize(16, 16)) self.setOrientation(orientation)
def __init__(self, parent, canvas): QToolBar.__init__(self, parent) self._canvas = canvas self.addAction(qApp.style().standardIcon(QStyle.SP_DialogSaveButton), "Save", canvas.saveImg) self.addAction("Zoom +", canvas.zoomUp) self.addAction("Zoom -", canvas.zoomDown) self.addAction("Configure", canvas.configure)
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)
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)
def __init__(self, parent): QToolBar.__init__(self, parent) pal = QPalette(self.palette()) pal.setColor(self.backgroundRole(), QColor(105, 100, 97)) self.setPalette(pal) self.setAutoFillBackground(True) self.__objects = [] self.init() self.__type = None self.__mode = ViewMode self.__menu = None
def __init__(self, parent=None, *args, **kwargs): QToolBar.__init__(self, parent, *args, **kwargs) self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) menu = [{"name": u"Tableau de bord", "icon": 'example', "admin": False, "goto": ExampleViewWidget}, ] for m in menu: self.addAction(QIcon("{}{}.png".format(Constants.img_media, m.get( 'icon'))), m.get('name'), lambda m=m: self.goto(m.get('goto'))) self.addSeparator()
def __init__(self, actions, parent=None, name = ''): if name: QToolBar.__init__(self, name, parent) else: QToolBar.__init__(self, parent) self.addSeparator() self.setMovable(False) self.setAllowedAreas(Qt.TopToolBarArea) self.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) for action in actions: self.addAction(action)
def __init__(self, canvas, parent, coordinates=True): """ coordinates: should we show the coordinates on the right? """ self.canvas = canvas self.parent = parent self.coordinates = coordinates self._actions = {} self.cursor_line = None self.cursor_cid = None self.color = 'r' QToolBar.__init__(self, parent) NavigationToolbar2.__init__(self, canvas)
def __init__(self, parent=None, admin=False, *args, **kwargs): QToolBar.__init__(self, parent, *args, **kwargs) self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.setIconSize(QSize(30, 30)) font = QFont() font.setPointSize(8) font.setBold(True) font.setWeight(75) self.setFont(font) self.setCursor(QCursor(Qt.PointingHandCursor)) self.setAcceptDrops(True) self.setAutoFillBackground(True) # Menu File self.setOrientation(Qt.Horizontal) self.addAction(QIcon(u"{}exit.png".format(Config.img_cmedia)), u"Quiter", self.goto_exit) menu = [ { "name": u"Enregister une Demande", "icon": 'add', "admin": False, "goto": RegistrationViewWidget }, { "name": u"Demandes en cours", "icon": 'report', "admin": False, "goto": ResgistrationManagerWidget }, { "name": u"Répertoire Coopératives", "icon": 'cooperatives', "admin": False, "goto": CooperativeSocietyViewWidget }, { "name": u"Tableau de bord", "icon": 'dashboard', "admin": False, "goto": DashbordViewWidget }, ] # self.addSeparator() for m in menu: self.addSeparator() self.addAction(QIcon("{}{}.png".format(Config.img_media, m.get('icon'))), m.get('name'), lambda m=m: self.goto(m.get('goto')))
def __init__(self, parent): QToolBar.__init__(self, parent) assert parent self.dock = parent # a fake spacer widget w = QWidget(self) l = QHBoxLayout(w) l.setMargin(0) l.setSpacing(0) l.addStretch() frame = QFrame() layout = QBoxLayout(QBoxLayout.LeftToRight, frame) layout.setContentsMargins(4, 4, 0, 0) layout.setSpacing(2) self.aDockFrame = self.addWidget(frame) self.__icon = QLabel() layout.addWidget(self.__icon) layout.addWidget(QLabel(self.dock.windowTitle())) self.dock.windowIconChanged.connect(self.__setWindowIcon) # fake spacer item spacer = QWidgetAction(self) spacer.setDefaultWidget(w) self.setMovable(False) self.setFloatable(False) self.setIconSize(QSize(12, 12)) self.aFloat = QAction(self) self.aClose = QAction(self) QToolBar.addAction(self, spacer) self.separator = QToolBar.addSeparator(self) QToolBar.addAction(self, self.aFloat) QToolBar.addAction(self, self.aClose) self.updateStandardIcons() self.dockWidgetFeaturesChanged(self.dock.features()) self.dock.featuresChanged.connect(self.dockWidgetFeaturesChanged) self.aFloat.triggered.connect(self._floatTriggered) self.aClose.triggered.connect(self.dock.close)
def __init__ ( self, tool_bar_manager, parent ): """ Initializes the object. """ QToolBar.__init__( self, parent ) # Listen for changes to the tool bar manager's enablement and # visibility: self.tool_bar_manager = tool_bar_manager tool_bar_manager.on_facet_set( self._on_tool_bar_manager_enabled_modified, 'enabled' ) tool_bar_manager.on_facet_set( self._on_tool_bar_manager_visible_modified, 'visible' )
def __init__(self, parent, distributedObjects): QToolBar.__init__(self, "QuickWatch") self.config = QuickWatchConfig() distributedObjects.configStore.registerConfigSet(self.config) self.setObjectName("QuickWatch") parent.addToolBar(self) self.watchedit = QComboBox() self.watchedit.setFixedHeight(28) self.watchedit.setInsertPolicy(QComboBox.NoInsert) self.watchedit.setEditable(True) self.watchedit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.addWidget(self.watchedit) self.distributedObjects = distributedObjects self.addAction(Icons.watch, "Add to Watch", self.addToWatch) self.addAction(Icons.datagraph, "Add to Data Graph", self.addToDG) self.watchedit.lineEdit().returnPressed.connect(self.returnPressed)
def __init__(self, *args): QToolBar.__init__(self, *args) self._queuedWidget = _QueuedMessageWidget( self ) self.setObjectName( self.metaObject().className() ) self.setMovable( False ) self.setFloatable( False ) self.setAllowedAreas( Qt.TopToolBarArea ) self.toggleViewAction().setEnabled( False ) self.toggleViewAction().setVisible( False ) self.addWidget( self._queuedWidget ) self.layout().setMargin( 3 ) # connections self._queuedWidget.shown.connect(self.messageShown) self._queuedWidget.finished.connect(self.messageFinished)
def __init__(self, parent): self.parent = parent QToolBar.__init__(self) self.setObjectName('sideBar') self.parent.addToolBar(Qt.LeftToolBarArea, self) self.setIconSize( QSize(48, 48)) self.setMovable(False) self.dock = QDockWidget() self.dock.setObjectName('sideBarDock') self.dock.stack = QStackedWidget() self.stack = self.dock.stack self.dock.setWidget(self.stack) self.parent.addDockWidget(Qt.LeftDockWidgetArea, self.dock) self.dock.hide()
def __init__(self, parent, *args): QToolBar.__init__(self, parent, *args) self.setSizePolicy( QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Maximum ) ) self._dock = parent self.aClose = QToolBar.addAction(self, self.style().standardIcon( QStyle.SP_TitleBarCloseButton ), "") self.setMovable( False ) self.setFloatable( False ) self.aClose.triggered.connect(self._dock.close) textHeight = QFontMetrics(self.font()).height() self.setIconSize(QSize(textHeight, textHeight)) # a fake spacer widget self._spacer = QWidget( self ) self._spacer.setSizePolicy( QSizePolicy( QSizePolicy.Expanding, QSizePolicy.MinimumExpanding ) ) self.addWidget( self._spacer )
def __init__(self): QToolBar.__init__(self, "PlotTools") self.setObjectName("PlotToolBar") self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.__reset_scales = self.createAction( "Reset Scales", util.resourceIcon("ide/transform_scale")) self.__reset_scales.triggered.connect(self.resetScalesClicked) self.__x_min, self.__x_min_action = self.addScaler( "x_min", "X Minimum", spinner_type=CTime, select_min_time_value=True) self.__x_max, self.__x_max_action = self.addScaler("x_max", "X Maximum", spinner_type=CTime) self.__y_min, self.__y_min_action = self.addScaler( "y_min", "Y Minimum", spinner_type=float, select_min_time_value=True) self.__y_max, self.__y_max_action = self.addScaler("y_max", "Y Maximum", spinner_type=float) self.__report_step_widget = ReportStepWidget() self.__report_step_widget.reportStepTimeSelected.connect( self.reportStepChanged) self.__report_step_widget.setFontSize(PlotToolBar.FONT_SIZE) self.__report_step_widget_action = self.addWidget( self.__report_step_widget) self.addSeparator() export_action = self.createAction( "Export Plot", util.resourceIcon("ide/table_export")) export_action.triggered.connect(self.exportClicked)
def __init__(self, parent=None, admin=False, *args, **kwargs): QToolBar.__init__(self, parent, *args, **kwargs) self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.setIconSize(QSize(30, 30)) font = QFont() font.setPointSize(8) font.setBold(True) font.setWeight(75) self.setFont(font) self.setCursor(QCursor(Qt.PointingHandCursor)) self.setAcceptDrops(True) self.setAutoFillBackground(True) # Menu File self.setOrientation(Qt.Horizontal) self.addAction( QIcon(u"{}exit.png".format(Config.img_cmedia)), u"Quiter", self.goto_exit) # self.addSeparator() menu = [{"name": u"Tableau de bord", "icon": 'dashboard', "admin": False, "goto": DashbordViewWidget}, {"name": u"Entrée", "icon": 'in', "admin": False, "goto": StockInputWidget}, {"name": u"Sortie", "icon": 'out', "admin": True, "goto": StockOutputWidget}, {"name": u"Commande", "admin": True, "icon": 'order', "goto": OrderViewWidget}, {"name": u"State", "icon": 'state', "admin": False, "goto": StateStockViewWidget}, {"name": u"Articles", "admin": True, "icon": 'product', "goto": ProductsViewWidget}, {"name": u"Inventaire", "icon": 'inventory', "admin": False, "goto": InventoryViewWidget}, ] for m in menu: self.addSeparator() self.addAction(QIcon("{}{}.png".format(Config.img_media, m.get('icon'))), m.get('name'), lambda m=m: self.goto(m.get('goto')))
def __init__(self, parent, *args): QToolBar.__init__(self, parent, *args) self.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum)) self._dock = parent self.aClose = QToolBar.addAction( self, self.style().standardIcon(QStyle.SP_TitleBarCloseButton), "") self.setMovable(False) self.setFloatable(False) self.aClose.triggered.connect(self._dock.close) textHeight = QFontMetrics(self.font()).height() self.setIconSize(QSize(textHeight, textHeight)) # a fake spacer widget self._spacer = QWidget(self) self._spacer.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.MinimumExpanding)) self.addWidget(self._spacer)
def __init__(self, parent=None): QToolBar.__init__(self, parent) self.parent = parent self.setupUi()
def __init__(self, parent, workdir=None): QToolBar.__init__(self, parent) SMPluginMixin.__init__(self, parent) # Initialize plugin self.initialize_plugin() # Setting default values for editor-related options self.get_option('editor/open/browse_scriptdir', True) self.get_option('editor/open/browse_workdir', False) self.get_option('editor/new/browse_scriptdir', False) self.get_option('editor/new/browse_workdir', True) self.get_option('editor/open/auto_set_to_basedir', False) self.get_option('editor/save/auto_set_to_basedir', False) self.setWindowTitle(self.get_plugin_title()) # Toolbar title self.setObjectName( self.get_plugin_title()) # Used to save Window state # Previous dir action self.history = [] self.histindex = None self.previous_action = create_action(self, "previous", None, get_icon('previous.png'), _('Back'), triggered=self.previous_directory) self.addAction(self.previous_action) # Next dir action self.history = [] self.histindex = None self.next_action = create_action(self, "next", None, get_icon('next.png'), _('Next'), triggered=self.next_directory) self.addAction(self.next_action) # Enable/disable previous/next actions self.connect(self, SIGNAL("set_previous_enabled(bool)"), self.previous_action.setEnabled) self.connect(self, SIGNAL("set_next_enabled(bool)"), self.next_action.setEnabled) # Path combo box adjust = self.get_option('working_dir_adjusttocontents', False) self.pathedit = PathComboBox(self, adjust_to_contents=adjust) self.pathedit.setToolTip( _("This is the working directory for newly\n" "opened consoles (Python interpreters and\n" "terminals), for the file explorer, for the\n" "find in files plugin and for new files\n" "created in the editor")) self.connect(self.pathedit, SIGNAL("open_dir(QString)"), self.chdir) self.pathedit.setMaxCount(self.get_option('working_dir_history', 20)) wdhistory = self.load_wdhistory(workdir) if workdir is None: if self.get_option('startup/use_last_directory', True): if wdhistory: workdir = wdhistory[0] else: workdir = "." else: workdir = self.get_option('startup/fixed_directory', ".") if not osp.isdir(workdir): workdir = "." self.chdir(workdir) self.pathedit.addItems(wdhistory) self.refresh_plugin() self.addWidget(self.pathedit) # Browse action browse_action = create_action(self, "browse", None, get_std_icon('DirOpenIcon'), _('Browse a working directory'), triggered=self.select_directory) self.addAction(browse_action) # Set current console working directory action setwd_action = create_action(self, icon=get_icon('set_workdir.png'), text=_("Set as current console's " "working directory"), triggered=self.set_as_current_console_wd) self.addAction(setwd_action) # Parent dir action parent_action = create_action(self, "parent", None, get_icon('up.png'), _('Change to parent directory'), triggered=self.parent_directory) self.addAction(parent_action)
def __init__(self, parent, workdir=None): QToolBar.__init__(self, parent) PluginMixin.__init__(self, parent) self.setWindowTitle(self.get_widget_title()) # Toolbar title self.setObjectName( self.get_widget_title()) # Used to save Window state self.addWidget(QLabel(self.tr("Working directory:") + " ")) # Previous dir action self.history = [] self.histindex = None self.previous_action = create_action(self, "previous", None, get_icon('previous.png'), self.tr('Back'), triggered=self.previous_directory) self.addAction(self.previous_action) # Next dir action self.history = [] self.histindex = None self.next_action = create_action(self, "next", None, get_icon('next.png'), self.tr('Next'), triggered=self.next_directory) self.addAction(self.next_action) # Enable/disable previous/next actions self.connect(self, SIGNAL("set_previous_enabled(bool)"), self.previous_action.setEnabled) self.connect(self, SIGNAL("set_next_enabled(bool)"), self.next_action.setEnabled) # Path combo box adjust = CONF.get('shell', 'working_dir_adjusttocontents', False) self.pathedit = PathComboBox(self, adjust_to_contents=adjust) self.pathedit.setToolTip(self.tr("Working directory")) self.connect(self.pathedit, SIGNAL("open_dir(QString)"), self.pathedit_activated) self.pathedit.setMaxCount(CONF.get('shell', 'working_dir_history')) wdhistory = self.load_wdhistory(workdir) if workdir is None: if wdhistory: workdir = wdhistory[0] else: workdir = "." self.chdir(workdir) self.pathedit.addItems(wdhistory) self.refresh() self.addWidget(self.pathedit) # Browse action browse_action = create_action(self, "browse", None, get_std_icon('DirOpenIcon'), self.tr('Browse a working directory'), triggered=self.select_directory) self.addAction(browse_action) # Parent dir action parent_action = create_action(self, "parent", None, get_icon('up.png'), self.tr('Change to parent directory'), triggered=self.parent_directory) self.addAction(parent_action)
def __init__(self,parent): QToolBar.__init__(self,parent) self.parent = parent self.action_NewProject = QAction(Icons.newprj, 'Project', self) self.action_NewProject.triggered.connect(self.parent.treeWidget.newProject) self.action_NewProject.setToolTip("Create a New Project") self.action_Open = QAction(Icons.open, 'Open', self) self.action_Open.triggered.connect(self.parent.fileOpen) self.action_Open.setToolTip("Open File") self.action_Save = QAction(Icons.save, 'Save', self) self.action_Save.setShortcut('Ctrl+S') self.action_Save.triggered.connect(self.parent.fileSave) self.action_Save.setToolTip("Save Current File") self.action_SaveAll = QAction(Icons.saveall, 'SaveAll', self) self.action_SaveAll.setShortcut('Ctrl+A') self.action_SaveAll.triggered.connect(self.parent.fileSaveAll) self.action_SaveAll.setToolTip("Save All Files") self.action_Build = QAction(Icons.thread_view, 'Build', self) self.action_Build.setShortcut('Ctrl+B') self.action_Build.triggered.connect(self.parent.build_project) self.action_Debug = QAction(Icons.debug_exec, 'Debug', self) self.action_Refresh = QAction(Icons.refresh_tab, 'Refresh', self) self.action_Refresh.triggered.connect(self.parent.treeWidget.refreshCurrentProject) self.action_Run = QAction(Icons.run, 'Run', self) self.action_Run.setShortcut('Ctrl+R') self.action_Run.triggered.connect(self.parent.adb.run) self.action_RunFile = QAction(Icons.go, 'Cmd', self) self.action_RunFile.triggered.connect(self.parent.openCommand) self.parent.runButton.clicked.connect(self.parent.command.setCmdLine) self.action_Stop = QAction(Icons.stop, 'Stop', self) self.action_Stop.setShortcut('Ctrl+Q') self.action_Stop.triggered.connect(self.parent.adb.stop) self.action_Design = QAction(Icons.color_palette, 'Design', self) self.action_Design.triggered.connect(self.parent.design) self.action_Level = QAction(Icons.cmpC_pal, 'Level', self) self.action_Level.triggered.connect(self.parent.level) self.action_Todo = QAction(Icons.task_set, 'Todo', self) self.action_Todo.triggered.connect(self.parent.todo) self.action_Help = QAction(Icons.toc_open, 'Help', self) self.action_Help.triggered.connect(self.parent.help) self.action_Full = QAction(Icons.fullscreen, 'Full', self) self.action_Full.triggered.connect(self.parent.full) self.action_Stop.setDisabled(True) self.setToolLabel() self.setAllowedAreas(Qt.AllToolBarAreas) #self.setFixedHeight(40) #self.setIconSize(QSize(config.iconSize(),config.iconSize())) ''' Adding all Actions ''' self.addAction(self.action_NewProject) self.addAction(self.action_Open) self.addAction(self.action_Save) self.addAction(self.action_SaveAll) #self.addAction(self.action_Refresh) self.addSeparator() self.addAction(self.action_Build) self.addAction(self.action_Run) #self.addAction(self.action_RunFile) self.addAction(self.action_Stop) self.addAction(self.action_Debug) self.addSeparator() self.addAction(self.action_Design) self.addAction(self.action_Level) self.addAction(self.action_Todo) self.initOptionsMenu() self.addSeparator() self.initStyleMenu() self.initLexerMenu() self.initApiMenu() #self.addAction(self.action_Help) #self.addAction(self.action_Full) self.addSeparator() self.initModeMenu()
def __init__(self, parent=None, *args, **kwargs): QToolBar.__init__(self, *args, **kwargs)
def __init__(self, parent, workdir=None): QToolBar.__init__(self, parent) SMPluginMixin.__init__(self, parent) # Initialize plugin self.initialize_plugin() # Setting default values for editor-related options self.get_option('editor/open/browse_scriptdir', True) self.get_option('editor/open/browse_workdir', False) self.get_option('editor/new/browse_scriptdir', False) self.get_option('editor/new/browse_workdir', True) self.get_option('editor/open/auto_set_to_basedir', False) self.get_option('editor/save/auto_set_to_basedir', False) self.setWindowTitle(self.get_plugin_title()) # Toolbar title self.setObjectName(self.get_plugin_title()) # Used to save Window state # Previous dir action self.history = [] self.histindex = None self.previous_action = create_action(self, "previous", None, get_icon('previous.png'), _('Back'), triggered=self.previous_directory) self.addAction(self.previous_action) # Next dir action self.history = [] self.histindex = None self.next_action = create_action(self, "next", None, get_icon('next.png'), _('Next'), triggered=self.next_directory) self.addAction(self.next_action) # Enable/disable previous/next actions self.connect(self, SIGNAL("set_previous_enabled(bool)"), self.previous_action.setEnabled) self.connect(self, SIGNAL("set_next_enabled(bool)"), self.next_action.setEnabled) # Path combo box adjust = self.get_option('working_dir_adjusttocontents', False) self.pathedit = PathComboBox(self, adjust_to_contents=adjust) self.pathedit.setToolTip(_("This is the working directory for newly\n" "opened consoles (Python interpreters and\n" "terminals), for the file explorer, for the\n" "find in files plugin and for new files\n" "created in the editor")) self.connect(self.pathedit, SIGNAL("open_dir(QString)"), self.chdir) self.pathedit.setMaxCount(self.get_option('working_dir_history', 20)) wdhistory = self.load_wdhistory( workdir ) if workdir is None: if self.get_option('startup/use_last_directory', True): if wdhistory: workdir = wdhistory[0] else: workdir = "." else: workdir = self.get_option('startup/fixed_directory', ".") if not osp.isdir(workdir): workdir = "." self.chdir(workdir) self.pathedit.addItems( wdhistory ) self.refresh_plugin() self.addWidget(self.pathedit) # Browse action browse_action = create_action(self, "browse", None, get_std_icon('DirOpenIcon'), _('Browse a working directory'), triggered=self.select_directory) self.addAction(browse_action) # Set current console working directory action setwd_action = create_action(self, icon=get_icon('set_workdir.png'), text=_("Set as current console's " "working directory"), triggered=self.set_as_current_console_wd) self.addAction(setwd_action) # Parent dir action parent_action = create_action(self, "parent", None, get_icon('up.png'), _('Change to parent directory'), triggered=self.parent_directory) self.addAction(parent_action)
def __init__(self, *args, **kwargs): QToolBar.__init__(self, *args, **kwargs) self.setMinimumHeight(64)
def __init__(self, parent=None, *args, **kwargs): QToolBar.__init__(self, parent, *args, **kwargs) self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) # self.setIconSize(QSize(35, 35)) # font = QFont() # font.setPointSize(10) # font.setBold(True) # font.setWeight(35) # self.setFont(font) # self.setCursor(QCursor(Qt.PointingHandCursor)) # self.setFocusPolicy(Qt.TabFocus) # self.setContextMenuPolicy(Qt.CustomContextMenu) self.setAcceptDrops(True) # self.setAutoFillBackground(True) self.addSeparator() self.addAction(QIcon(u"{}exit.png".format(Config.img_cmedia)), u"Quiter", self.goto_exit) menu = [ { "name": u"Tableau de bord", "icon": 'dashboard', "admin": False, "goto": DashbordViewWidget }, # {"name": u"Articles", "admin": True, # "icon": 'product', "goto": ProductsViewWidget}, { "name": u"Caise", "admin": False, "icon": 'apricots', "goto": ApricotsViewWidget }, { "name": u"Vente", "admin": False, "icon": 'invoice', "goto": InvoiceViewWidget }, { "name": u"Arivage", "admin": True, "icon": 'buy', "goto": BuyViewWidget }, { "name": u"Statut", "admin": True, "icon": 'State', "goto": StatViewWidget }, { "name": u"Versement", "admin": True, "icon": 'reports', "goto": PaymentViewWidget }, { "name": u"Inventaire", "admin": True, "icon": 'inventory', "goto": InventoryViewWidget }, { "name": u"Dettes", "admin": True, "icon": 'debt', "goto": DebtsViewWidget }, ] for m in menu: self.addSeparator() self.addAction(QIcon("{}{}.png".format(Config.img_media, m.get('icon'))), m.get('name'), lambda m=m: self.goto(m.get('goto')))
def __init__(self,parent): QToolBar.__init__(self,parent) self.parent = parent self.action_NewProject = QAction(Icons.newprj, 'Project', self) self.action_NewProject.triggered.connect(self.parent.treeWidget.newProject) self.action_NewProject.setToolTip("Create a New Project") self.action_Open = QAction(Icons.open, 'Open', self) self.action_Open.triggered.connect(self.parent.fileOpen) self.action_Open.setToolTip("Open File") self.action_Save = QAction(Icons.save, 'Save', self) self.action_Save.setShortcut('Ctrl+S') self.action_Save.triggered.connect(self.parent.fileSave) self.action_Save.setToolTip("Save Current File") self.action_SaveAll = QAction(Icons.saveall, 'SaveAll', self) self.action_SaveAll.setShortcut('Ctrl+A') self.action_SaveAll.triggered.connect(self.parent.fileSaveAll) self.action_SaveAll.setToolTip("Save All Files") self.action_Build = QAction(Icons.thread_view, 'Build', self) self.action_Build.setShortcut('Ctrl+B') self.action_Build.triggered.connect(self.parent.build_project) self.action_Debug = QAction(Icons.debug_exec, 'Debug', self) self.action_Refresh = QAction(Icons.refresh_tab, 'Refresh', self) self.action_Refresh.triggered.connect(self.parent.treeWidget.refreshCurrentProject) self.action_Run = QAction(Icons.run, 'Run', self) self.action_Run.setShortcut('Ctrl+R') self.action_Run.triggered.connect(self.parent.adb.run) self.action_RunFile = QAction(Icons.go, 'Cmd', self) self.action_RunFile.triggered.connect(self.parent.openCommand) self.parent.runButton.clicked.connect(self.parent.command.setCmdLine) self.action_Stop = QAction(Icons.stop, 'Stop', self) self.action_Stop.setShortcut('Ctrl+Q') self.action_Stop.triggered.connect(self.parent.adb.stop) self.action_Design = QAction(Icons.color_palette, 'Design', self) self.action_Design.triggered.connect(self.parent.design) self.action_Level = QAction(Icons.cmpC_pal, 'Level', self) self.action_Level.triggered.connect(self.parent.level) self.action_Todo = QAction(Icons.task_set, 'Todo', self) self.action_Todo.triggered.connect(self.parent.todo) self.action_Help = QAction(Icons.toc_open, 'Help', self) self.action_Help.triggered.connect(self.parent.help) men = QMenu() #Threshold Slider self.threshSlider = QSlider() self.threshSlider.setTickPosition(QSlider.TicksLeft) self.threshSlider.setOrientation(Qt.Horizontal) self.threshSlider.setValue(config.thresh()) self.threshSlider.setMinimum(0) self.threshSlider.setMaximum(5) self.threshSlider.valueChanged.connect(self.parent.setThreshold) self.threshSliderAction = QWidgetAction(men) self.threshSliderAction.setDefaultWidget(self.threshSlider) #TabsWidth Slider self.tabsSlider = QSlider() self.tabsSlider.setTickPosition(QSlider.TicksLeft) self.tabsSlider.setOrientation(Qt.Horizontal) self.tabsSlider.setValue(config.tabwidth()) self.tabsSlider.setMinimum(0) self.tabsSlider.setMaximum(8) self.tabsSlider.valueChanged.connect(self.parent.setTabWidth) self.tabsSliderAction = QWidgetAction(men) self.tabsSliderAction.setDefaultWidget(self.tabsSlider) #iconSize Slider self.iconSlider = QSlider() self.iconSlider.setTickPosition(QSlider.TicksLeft) self.iconSlider.setOrientation(Qt.Horizontal) self.iconSlider.setValue(config.iconSize()) self.iconSlider.setMinimum(16) self.iconSlider.setMaximum(32) self.iconSlider.setSingleStep(2) self.iconSlider.valueChanged.connect(self.setIcon) self.iconSliderAction = QWidgetAction(men) self.iconSliderAction.setDefaultWidget(self.iconSlider) '''Font Button''' self.fontCombo = QFontComboBox() self.fontCombo.currentFontChanged.connect(self.parent.setFont) self.fontCombo.setCurrentFont(QFont(config.fontName())) self.fontComboMenu = QWidgetAction(men) self.fontComboMenu.setDefaultWidget(self.fontCombo) '''Font Size''' self.fontSizeCombo = QComboBox() for size in range(1,40): self.fontSizeCombo.addItem(str(size)) self.fontSizeCombo.setCurrentIndex(config.fontSize()) self.fontSizeCombo.currentIndexChanged.connect(self.parent.setFontSize) self.fontSizeComboMenu = QWidgetAction(men) self.fontSizeComboMenu.setDefaultWidget(self.fontSizeCombo) action_explorer = QAction("Show Explorer",self) action_explorer.triggered.connect(self.parent.exp) action_console = QAction("Show Console",self) action_console.triggered.connect(self.parent.cmd) action_designer = QAction("Show Designer",self) action_designer.triggered.connect(self.parent.design) action_Indentation = QAction("Indentation Guides",self) action_Indentation.triggered.connect(self.parent.setIndent) action_WhiteSpace = QAction("Show WhiteSpace",self) action_WhiteSpace.triggered.connect(self.parent.setWhiteSpace) action_EndLine = QAction("Show End of Lines",self) action_EndLine.triggered.connect(self.parent.setEndLine) action_Margin = QAction("Line Numbers",self) action_Margin.triggered.connect(self.parent.setMargin) action_ToolLabel = QAction("Tool Labels",self) action_ToolLabel.triggered.connect(self.setToolLabel) action_Android = QAction(Icons.android,'Android', self) action_Android.triggered.connect(self.parent.android) action_Ant = QAction(Icons.ant_view,'Ant', self) action_Ant.triggered.connect(self.parent.antt) action_Squirrel = QAction(Icons.nut,'Squirrel', self) action_Squirrel.triggered.connect(self.parent.squirrel) action_Ios1 = QAction(Icons.ios,'iOS', self) action_Update = QAction("Update",self) action_Update.triggered.connect(self.parent.update) '''Encoding''' encodingGroup = QActionGroup(self) encodingGroup.setExclusive(True) action_Ascii = QAction("Ascii",encodingGroup) action_Ascii.setCheckable(True) action_Unicode = QAction("Unicode",encodingGroup) action_Unicode.setCheckable(True) encodingGroup.addAction(action_Ascii) encodingGroup.addAction(action_Unicode) encodingGroup.selected.connect(self.parent.setEncoding) if(config.encoding() == Encoding.ASCII): action_Ascii.setChecked(True) else: action_Unicode.setChecked(True) men.addAction(action_Android) men.addAction(action_Ant) men.addAction(action_Squirrel) men.addAction(action_Ios1) men.addAction(action_Update) men.addSeparator() men.addAction(action_explorer) men.addAction(action_console) men.addAction(action_designer) men.addAction(action_Indentation) men.addAction(action_WhiteSpace) men.addAction(action_EndLine) men.addAction(action_Margin) men.addAction(action_ToolLabel) men.addSeparator() men.addActions(encodingGroup.actions()) men.addSeparator() head_font = QLabel("Font---------------------") fnt = head_font.font() fnt.setBold(True) head_font.setFont(fnt) head_fontWidgetAction = QWidgetAction(men) head_fontWidgetAction.setDefaultWidget(head_font) men.addAction(head_fontWidgetAction) men.addAction(self.fontComboMenu) men.addAction(self.fontSizeComboMenu) men.addSeparator() men.addAction(QAction("TabWidth",self)) men.addAction(self.tabsSliderAction) men.addSeparator() men.addAction(QAction("Threshold",self)) men.addAction(self.threshSliderAction) #men.addAction(QAction("Icon Size",self)) #men.addAction(self.iconSliderAction) self.action_Options = QAction(Icons.emblem_system, 'Options', self) self.action_Options.setMenu(men) self.action_Full = QAction(Icons.fullscreen, 'Full', self) self.action_Full.setShortcut('Shift+Enter') self.action_Full.triggered.connect(self.parent.full) self.modeGroup = QActionGroup(self) self.modeGroup.setExclusive(True) self.modeGroup.selected.connect(self.parent.setMode) self.action_Squirrel = QAction(Icons.nut, 'Squ', self.modeGroup) self.action_Squirrel.setCheckable(True) self.action_Emo = QAction(Icons.emo, 'Emo', self.modeGroup) self.action_Emo.setCheckable(True) self.action_And = QAction(Icons.android, 'Android', self.modeGroup) self.action_And.setCheckable(True) self.action_Ios = QAction(Icons.ios, 'ios', self.modeGroup) self.action_Ios.setCheckable(True) self.modeGroup.addAction(self.action_Squirrel) self.modeGroup.addAction(self.action_Emo) self.modeGroup.addAction(self.action_And) self.modeGroup.addAction(self.action_Ios) self.action_Style = QAction(Icons.style, 'Style', self) men1 = QMenu() self.styleslist = [] self.style1 = QAction("All Hallow's Eve",self) self.style1.triggered.connect(lambda:self.parent.style_clicked(1)) self.style1.setCheckable(True) self.style2 = QAction("Amy",self) self.style2.triggered.connect(lambda:self.parent.style_clicked(2)) self.style2.setCheckable(True) self.style3 = QAction("Aptana Studio",self) self.style3.triggered.connect(lambda:self.parent.style_clicked(3)) self.style3.setCheckable(True) self.style4 = QAction("Bespin",self) self.style4.triggered.connect(lambda:self.parent.style_clicked(4)) self.style4.setCheckable(True) self.style5 = QAction("Blackboard",self) self.style5.triggered.connect(lambda:self.parent.style_clicked(5)) self.style5.setCheckable(True) self.style6 = QAction("Choco",self) self.style6.triggered.connect(lambda:self.parent.style_clicked(6)) self.style6.setCheckable(True) self.style7 = QAction("Cobalt",self) self.style7.triggered.connect(lambda:self.parent.style_clicked(7)) self.style7.setCheckable(True) self.style8 = QAction("Dawn",self) self.style8.triggered.connect(lambda:self.parent.style_clicked(8)) self.style8.setCheckable(True) self.style9 = QAction("Eclipse",self) self.style9.triggered.connect(lambda:self.parent.style_clicked(9)) self.style9.setCheckable(True) self.styleslist.append(self.style1) self.styleslist.append(self.style2) self.styleslist.append(self.style3) self.styleslist.append(self.style4) self.styleslist.append(self.style5) self.styleslist.append(self.style6) self.styleslist.append(self.style7) self.styleslist.append(self.style8) self.styleslist.append(self.style9) men1.addActions(self.styleslist) self.action_Style.setMenu(men1) self.styleslist[self.parent.styleIndex].setChecked(True) self.action_Stop.setDisabled(True) self.setToolLabel() self.setAllowedAreas(Qt.AllToolBarAreas) #self.setFixedHeight(40) #self.setIconSize(QSize(config.iconSize(),config.iconSize())) self.addAction(self.action_NewProject) self.addAction(self.action_Open) self.addAction(self.action_Save) self.addAction(self.action_SaveAll) #self.addAction(self.action_Refresh) self.addSeparator() self.addAction(self.action_Build) self.addAction(self.action_Run) self.addAction(self.action_RunFile) self.addAction(self.action_Stop) self.addAction(self.action_Debug) self.addSeparator() self.addAction(self.action_Design) self.addAction(self.action_Level) self.addAction(self.action_Todo) self.addAction(self.action_Options) self.addAction(self.action_Style) self.addSeparator() self.addAction(self.action_Help) self.addAction(self.action_Full) self.addSeparator() self.addActions(self.modeGroup.actions()) if(config.mode() == 0): self.action_Squirrel.setChecked(True) elif(config.mode() == 1): self.action_Emo.setChecked(True) elif(config.mode() == 2): self.action_And.setChecked(True) elif(config.mode() == 3): self.action_Ios.setChecked(True)
def __init__(self, parent, workdir=None): QToolBar.__init__(self, parent) PluginMixin.__init__(self, parent) self.setWindowTitle(self.get_widget_title()) # Toolbar title self.setObjectName(self.get_widget_title()) # Used to save Window state self.addWidget( QLabel(self.tr("Working directory:")+" ") ) # Previous dir action self.history = [] self.histindex = None self.previous_action = create_action(self, "previous", None, get_icon('previous.png'), self.tr('Back'), triggered=self.previous_directory) self.addAction(self.previous_action) # Next dir action self.history = [] self.histindex = None self.next_action = create_action(self, "next", None, get_icon('next.png'), self.tr('Next'), triggered=self.next_directory) self.addAction(self.next_action) # Enable/disable previous/next actions self.connect(self, SIGNAL("set_previous_enabled(bool)"), self.previous_action.setEnabled) self.connect(self, SIGNAL("set_next_enabled(bool)"), self.next_action.setEnabled) # Path combo box adjust = CONF.get('shell', 'working_dir_adjusttocontents', False) self.pathedit = PathComboBox(self, adjust_to_contents=adjust) self.pathedit.setToolTip(self.tr("Working directory")) self.connect(self.pathedit, SIGNAL("open_dir(QString)"), self.pathedit_activated) self.pathedit.setMaxCount(CONF.get('shell', 'working_dir_history')) wdhistory = self.load_wdhistory( workdir ) if workdir is None: if wdhistory: workdir = wdhistory[0] else: workdir = "." self.chdir(workdir) self.pathedit.addItems( wdhistory ) self.refresh() self.addWidget(self.pathedit) # Browse action browse_action = create_action(self, "browse", None, get_std_icon('DirOpenIcon'), self.tr('Browse a working directory'), triggered=self.select_directory) self.addAction(browse_action) # Parent dir action parent_action = create_action(self, "parent", None, get_icon('up.png'), self.tr('Change to parent directory'), triggered=self.parent_directory) self.addAction(parent_action)
def __init__(self, parent=None): self._sections = [] self._sizes = None QToolBar.__init__(self, parent) self.layout().setSpacing(0)