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, rows, cols, parent = None): super(SpreadSheet, self).__init__(parent) self.toolBar = QToolBar() self.addToolBar(self.toolBar) self.formulaInput = QLineEdit() self.cellLabel = QLabel(self.toolBar) self.cellLabel.setMinimumSize(80, 0) self.toolBar.addWidget(self.cellLabel) self.toolBar.addWidget(self.formulaInput) self.table = QTableWidget(rows, cols, self) for c in range(cols): character = chr(ord('A') + c) self.table.setHorizontalHeaderItem(c, QTableWidgetItem(character)) self.table.setItemPrototype(self.table.item(rows - 1, cols - 1)) self.table.setItemDelegate(SpreadSheetDelegate(self)) self.createActions() self.updateColor(0) self.setupMenuBar() self.setupContents() self.setupContextMenu() self.setCentralWidget(self.table) self.statusBar() self.table.currentItemChanged.connect(self.updateStatus) self.table.currentItemChanged.connect(self.updateColor) self.table.currentItemChanged.connect(self.updateLineEdit) self.table.itemChanged.connect(self.updateStatus) self.formulaInput.returnPressed.connect(self.returnPressed) self.table.itemChanged.connect(self.updateLineEdit) self.setWindowTitle("Spreadsheet")
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): 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, callback): super().__init__() self.callback = callback #Toolbar toolbar = QToolBar(self) self.button_test = toolbar.addAction("Test script") self.button_burn = toolbar.addAction("Write script to ROM") #self.button_reload = toolbar.addAction("Refresh") self.button_pokescriptdoc = toolbar.addAction("PokeScript doc") self.button_pokescriptdoc.setToolTip("Opens your webbrowser, pointing at a page where some elemnets of PokeScript are explained.") self.button_scriptdoc = toolbar.addAction("List of commands.") self.button_scriptdoc.setToolTip("Opens a list of available commands in your default browser.") toolbar.actionTriggered.connect(self.toolbarAction) #Code editor sourceeditor = LNTextEdit(self) font = QFont("Monospace") font.setStyleHint(QFont.TypeWriter) sourceeditor.setFont(font) sourceeditor.setLineWrapMode(0) sourceeditor.setHighlighterClass(PokeScriptHighlighter) #Wrap it up layout = QVBoxLayout(self) layout.addWidget(toolbar) layout.addWidget(sourceeditor) layout.setContentsMargins(0, 0, 0, 0) #Store elements that we need later self.sourceeditor = sourceeditor
def createWidgets(self): """ QtWidgets creation """ self.dockToolbar = QToolBar(self) self.dockToolbar.setStyleSheet( "QToolBar { border: 0px }") # remove 3D border self.imageLabel = QLabel(self) self.imageLabel.setBackgroundRole(QPalette.Base) self.imageLabel.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) self.imageLabel.setScaledContents(True) self.scrollArea = QScrollArea() self.scrollArea.setBackgroundRole(QPalette.Dark) self.scrollArea.setWidget(self.imageLabel) title = QLabel("Image:") title.setStyleSheet("QLabel { padding-left: 2px; padding-top: 2px }") font = QFont() font.setBold(True) title.setFont(font) layout = QVBoxLayout() layout.addWidget(title) layout.addWidget(self.dockToolbar) layout.addWidget(self.scrollArea) layout.setContentsMargins(2, 2, 2, 2) self.setLayout(layout)
def __init__(self, page, parent=None): super(HelpForm, self).__init__(parent) self.setAttribute(Qt.WA_DeleteOnClose) self.setAttribute(Qt.WA_GroupLeader) backAction = QAction(QIcon(":/back.png"), "&Back", self) backAction.setShortcut(QKeySequence.Back) homeAction = QAction(QIcon(":/home.png"), "&Home", self) homeAction.setShortcut("Home") self.pageLabel = QLabel() toolBar = QToolBar() toolBar.addAction(backAction) toolBar.addAction(homeAction) toolBar.addWidget(self.pageLabel) self.textBrowser = QTextBrowser() layout = QVBoxLayout() layout.addWidget(toolBar) layout.addWidget(self.textBrowser, 1) self.setLayout(layout) self.connect(backAction, SIGNAL("triggered()"), self.textBrowser, SLOT("backward()")) self.connect(homeAction, SIGNAL("triggered()"), self.textBrowser, SLOT("home()")) self.connect(self.textBrowser, SIGNAL("sourceChanged(QUrl)"), self.updatePageTitle) self.textBrowser.setSearchPaths([":/help"]) self.textBrowser.setSource(QUrl(page)) self.resize(400, 600) self.setWindowTitle("{0} Help".format( QApplication.applicationName()))
def createControls(self): self.toolBarMain = QToolBar(self) self.toolBarMain.addAction(self.actionChangeBackground) self.toolBarMain.addAction(self.actionResetBackground) self.toolBarMain.addAction(self.actionChangeLayout) self.toolBarMain.addAction(self.actionClose) self.toolBarMain.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) self.toolBarMain.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.toolBarLayout = QToolBar(self) self.toolBarLayout.addAction(self.actionSelectWidgets) self.toolBarLayout.addAction(self.actionResetDefaultLayout) self.toolBarLayout.addAction(self.actionChangeLayout) self.toolBarLayout.addAction(self.actionClose) self.toolBarLayout.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) self.toolBarLayout.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.canvas = Canvas(self) self.layoutEditor = LayoutEditor(self) self.lblTitle = QLabel(self) self.lblTitle.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) self.setLayout(QVBoxLayout()) self.layoutTop = QHBoxLayout() self.layoutTop.addWidget(self.lblTitle) self.layoutTop.addWidget(self.toolBarMain) self.layoutTop.addWidget(self.toolBarLayout) self.toolBarLayout.hide() self.layout().addLayout(self.layoutTop) self.layout().addWidget(self.canvas) self.layout().addWidget(self.layoutEditor) self.layoutEditor.hide()
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 createDialog(self): """ Create qt dialog """ mainLayout = QVBoxLayout() self.dockToolbarComments = QToolBar(self) self.commentTextarea = QTextEdit() self.commentTextarea.setFixedHeight(150) self.commentsTextarea = QTextEdit() self.commentsTextarea.setReadOnly(True) self.commentsTextarea.setStyleSheet("""background-color: #EAEAEA; """) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setStyleSheet("""QDialogButtonBox { dialogbuttonbox-buttons-have-icons: 1; dialog-ok-icon: url(:/ok.png); dialog-cancel-icon: url(:/test-close-black.png); }""") self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) mainLayout.addWidget(self.dockToolbarComments) mainLayout.addWidget(self.commentTextarea) mainLayout.addWidget(self.commentsTextarea) mainLayout.addWidget(self.buttonBox) self.setLayout(mainLayout) self.setWindowTitle("Test Description > Comments") self.setFixedWidth(450) self.center()
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 createWidgets(self): """ Create qt widgets """ self.toolbar = QToolBar(self) self.toolbar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) layout = QVBoxLayout() if self.toXml: self.txtEdit = QtHelper.RawXmlEditor(parent=self) self.txtEdit.setFolding(QsciScintilla.BoxedTreeFoldStyle) self.txtEdit.setLexer(QsciLexerXML()) self.txtEdit.setText(self.__data) self.txtEdit.setUtf8(True) self.txtEdit.setFont(QFont("Courier", 9)) else: self.txtEdit = QtHelper.RawEditor(parent=self) self.txtEdit.setTabStopWidth(10) self.txtEdit.setText(self.__data) self.txtEdit.setFont(QFont("Courier", 9)) self.txtEdit.setMinimumWidth(650) self.txtEdit.setMinimumHeight(400) layout.addWidget(self.toolbar) layout.addWidget(self.txtEdit) self.setLayout(layout)
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, mainWindow): QToolBar.__init__(self) self.mainWindow = mainWindow self.doc = mainWindow.tabs.getCurrentWidget() self.Items() self.Layout() self.Signals()
def __init__(self, widget, parent=None): super(ToolDockWidget, self).__init__(parent) self.toolbar = None # QToolBar() self.widget = None # QWidget() self._spacer = None # QSpacerItem() self._contents = None # QWidget() self.toolbar = QToolBar(self) self.toolbar.setObjectName(u'toolbar') self.toolbar.setIconSize(QSize(22, 22)) self.toolbar2 = QToolBar(self) self.toolbar2.setObjectName(u'toolbar') self.toolbar2.setIconSize(QSize(22, 22)) self.toolbar2.setVisible(False) widget.setParent(self) self.widget = widget self._layout = QVBoxLayout(self) self._layout.setAlignment(Qt.AlignTop) self._layout.setObjectName(u'layout') self._layout.setContentsMargins(0, 0, 0, 0) self._layout.addWidget(self.toolbar) self._layout.addWidget(self.toolbar2) self._layout.addWidget(self.widget) self._contents = QWidget(self) self._contents.setObjectName(u'contents') self._contents.setLayout(self._layout) self.setWidget(self._contents)
def __init__(self, settings, parent=None): super(MikiWindow, self).__init__(parent) self.setObjectName("mikiWindow") self.settings = settings self.notePath = settings.notePath ################ Setup core components ################ self.notesTree = MikiTree(self) self.notesTree.setObjectName("notesTree") self.initTree(self.notePath, self.notesTree) self.notesTree.sortItems(0, Qt.AscendingOrder) self.ix = None self.setupWhoosh() self.viewedList = QToolBar(self.tr('Recently Viewed'), self) self.viewedList.setIconSize(QSize(16, 16)) self.viewedList.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.viewedListActions = [] self.noteSplitter = QSplitter(Qt.Horizontal) self.dockIndex = QDockWidget("Index") self.dockSearch = QDockWidget("Search") self.searchEdit = QLineEdit() self.searchView = MikiSearch(self) self.searchTab = QWidget() self.dockToc = QDockWidget("TOC") self.tocTree = TocTree() self.dockAttachment = QDockWidget("Attachment") self.attachmentView = AttachmentView(self) self.notesEdit = MikiEdit(self) self.notesEdit.setObjectName("notesEdit") MikiHighlighter(self.notesEdit) self.notesView = MikiView(self) self.findBar = QToolBar(self.tr('Find'), self) self.findBar.setFixedHeight(30) self.findEdit = QLineEdit(self.findBar) self.checkBox = QCheckBox(self.tr('Match case'), self.findBar) self.statusBar = QStatusBar(self) self.statusLabel = QLabel(self) self.altPressed = False ################ Setup actions ################ self.actions = dict() self.setupActions() ################ Setup mainwindow ################ self.setupMainWindow() # show changelogs after upgrade mikidown if self.settings.version < __version__: self.changelogHelp() self.settings.qsettings.setValue("version", __version__)
def buildToolBar(self): self.toolBar = QToolBar() self.toolBar.layout().setContentsMargins(0, 0, 0, 0) # Reload button self.reloadButton = QToolButton(self.toolBar) self.reloadButton.setIcon(QIcon(self.reloadPixmap)) self.reloadButton.setSizePolicy( QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) self.reloadButton.setAutoRaise(True) self.reloadButton.setBackgroundRole(self.backgroundRole()) self.reloadButton.setToolTip(self.str_RELOAD) self.connect(self.reloadButton, SIGNAL("clicked()"), self.refreshView) self.toolBar.addWidget(self.reloadButton) # Save button self.saveButton = QToolButton(self.toolBar) self.saveButton.setIcon(QIcon(self.savePixmap)) self.saveButton.setSizePolicy( QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) self.saveButton.setAutoRaise(True) self.saveButton.setBackgroundRole(self.backgroundRole()) self.saveButton.setToolTip(self.str_SAVE) self.connect(self.saveButton, SIGNAL("clicked()"), self.saveObject) self.toolBar.addWidget(self.saveButton) self.toolBar.addSeparator() # Add attribute button self.addAttributeButton = QToolButton(self.toolBar) self.addAttributeButton.setIcon(QIcon(self.addPixmap)) self.addAttributeButton.setSizePolicy( QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) self.addAttributeButton.setAutoRaise(True) self.addAttributeButton.setBackgroundRole(self.backgroundRole()) self.addAttributeButton.setToolTip(self.str_ADD) self.connect(self.addAttributeButton, SIGNAL("clicked()"), self.addAttribute) self.toolBar.addWidget(self.addAttributeButton) # Delete button self.deleteObjectButton = QToolButton(self.toolBar) self.deleteObjectButton.setIcon(QIcon(self.deleteSmallPixmap)) self.deleteObjectButton.setSizePolicy( QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) self.deleteObjectButton.setAutoRaise(True) self.deleteObjectButton.setBackgroundRole(self.backgroundRole()) self.deleteObjectButton.setToolTip(self.str_DELETE) self.connect(self.deleteObjectButton, SIGNAL("clicked()"), self.deleteObject) self.toolBar.addWidget(self.deleteObjectButton) self.comboBox.setToolTip(self.str_SWITCH_VIEWS) self.connect(self.comboBox, SIGNAL("currentIndexChanged(int)"), self.changeView) self.toolBar.addWidget(self.comboBox) self.enableToolButtons(False) self.layout().insertWidget(0, self.toolBar)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.eventId = None self.financeId = None self.personId = None self.clientId = None self.mkb = None self.characterId = None self.actAdd = QtGui.QAction(QIcon(':/new/prefix1/icons/new-icon.png'), u'Добавить', self) self.actAdd.setObjectName('actAdd') self.actEdit = QtGui.QAction( QIcon(':/new/prefix1/icons/edit-icon.png'), u'Изменить', self) self.actEdit.setObjectName('actEdit') self.actDuplicate = QtGui.QAction( QIcon(':/new/prefix1/icons/duplicate-icon.png'), u'Дублировать', self) self.actDuplicate.setObjectName('actDuplicate') self.actDelete = QtGui.QAction( QIcon(':/new/prefix1/icons/delete-icon.png'), u'Удалить', self) self.actDelete.setObjectName('actDelete') self.actPrint = QtGui.QAction( QIcon(':/new/prefix1/icons/print-icon.png'), u'Печать', self) self.actPrint.setObjectName('actPrint') self.actAnnul = QtGui.QAction(u'Изменить статус рецепта', self) self.actAnnul.setObjectName('actAnnul') self.actDrugstore = QtGui.QAction(u'Наличие ЛС в аптеках', self) self.actDrugstore.setObjectName('actDrugstore') self.setupUi(self) self.toolBar = QToolBar(self) self.toolBar.setIconSize(QSize(24, 24)) self.toolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.layout().insertWidget(0, self.toolBar) self.toolBar.addAction(self.actAdd) self.toolBar.addAction(self.actEdit) self.toolBar.addAction(self.actDelete) self.toolBar.addSeparator() self.toolBar.addAction(self.actPrint) self.toolBar.addSeparator() self.toolBar.addAction(self.actDrugstore) self.addModels('Items', CItemsModel(self)) self.tblItems.setModel(self.modelItems) self.tblItems.setSelectionModel(self.selectionModelItems) self.tblItems.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.tblItems.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self.connect(self.selectionModelItems, QtCore.SIGNAL('currentChanged(QModelIndex, QModelIndex)'), self.on_selectionModelItems_currentChanged) self.tblItems.createPopupMenu([self.actAnnul]) self.connect(self.tblItems.popupMenu(), QtCore.SIGNAL('aboutToShow()'), self.popupMenuAboutToShow) self.actEdit.setEnabled(False) self.actDelete.setEnabled(False) self.actPrint.setEnabled(False)
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): QWidget.__init__(self) IDEGeneric.__init__(self) self.setWindowTitle('NINJA-IDE {Ninja Is Not Just Another IDE}') self.setWindowIcon(QIcon(resources.images['icon'])) self.setWindowState(Qt.WindowMaximized) self.setMinimumSize(700, 500) #Opactity self.opacity = 1 #ToolBar self._toolbar = QToolBar() self._toolbar.setToolTip('Press and Drag to Move') styles.set_style(self._toolbar, 'toolbar-default') self.addToolBar(Qt.LeftToolBarArea, self._toolbar) self._toolbar.setToolButtonStyle(Qt.ToolButtonIconOnly) #StatusBar self._status = StatusBar() self._status.hide() self.setStatusBar(self._status) #Main Widgets self.main = MainWindow(self) self.setCentralWidget(self.main) #Menu menubar = self.menuBar() styles.apply(menubar, 'menu') file_ = menubar.addMenu('&File') edit = menubar.addMenu('&Edit') view = menubar.addMenu('&View') project = menubar.addMenu('&Project') self.pluginsMenu = menubar.addMenu('P&lugins') about = menubar.addMenu('&About') #The order of the icons in the toolbar is defined by this calls self._menuFile = MenuFile(file_, self._toolbar, self.main) self._menuView = MenuView(view, self, self.main) self._menuEdit = MenuEdit(edit, self._toolbar, self.main, self._status) self._menuProject = MenuProject(project, self._toolbar, self.main) self._menuPlugins = MenuPlugins(self.pluginsMenu, self) self._menuAbout = MenuAbout(about, self.main) self.main.container.load_toolbar(self._toolbar) self.main._central.actual_tab().obtain_editor().setFocus() filenames, projects_path = core.cliparser.parse() for filename in filenames: self.main.open_document(filename) for project_path in projects_path: self.main.open_project_folder(project_path) self.connect(self.main, SIGNAL("fileSaved(QString)"), self.show_status_message)
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)
class Browser(QWidget): def __init__(self): QWidget.__init__(self) self.setLayout(QVBoxLayout()) self.view = QWebView() self.layout().addWidget(self.view) self.toolbar = QToolBar() self.config = False if os.path.isfile('config/Skywind.yml'): self.view.setHtml(self.getReadme('Skywind')) button = QToolButton() button.setIcon(QIcon(icons_folder + 'Skywind_icon.png')) button.clicked.connect(lambda: self.view.setHtml(self.getReadme('Skywind'))) self.toolbar.addWidget(button) if os.path.isfile('config/Skyblivion.yml'): if not self.config: self.view.setHtml(self.getReadme('Skyblivion')) button = QToolButton() button.setIcon(QIcon(icons_folder + 'Skyblivion_icon.png')) button.clicked.connect(lambda: self.view.setHtml(self.getReadme('Skyblivion'))) self.toolbar.addWidget(button) def getReadme(self, game): self.config = Config(open('config/%s.yml' % game)) page = get(self.config.readme.url) if page.status_code == 200: tree = etree.HTML(page.content) content = tree.xpath(self.config.readme.xpath)[0] content = etree.tostring(content, pretty_print=True, method="html") css = """ <head> <link type="text/css" rel="stylesheet" media="all" href="http://morroblivion.com/sites/all/themes/morroblivion-%s/css/style.css?x" /> <style> img { margin: 0px auto; margin-bottom: 10px; display: none; /*while qt plugin missed*/ } .content {width: 512px; margin: 0 auto; background-color: %s; padding: 10px} </style> </head> """ % (self.config.readme.style, '#323232' if self.config.readme.style == 'dark' else '#eee') content = '%s<body>%s</body>' % (css, content) return content return 'Cant load page.'
def __createLayout(self): " Helper to create the viewer layout " self.globalsViewer = GlobalsBrowser() # Toolbar part - buttons self.definitionButton = QAction( PixmapCache().getIcon('definition.png'), 'Jump to highlighted item definition', self) self.definitionButton.triggered.connect(self.__goToDefinition) self.findButton = QAction(PixmapCache().getIcon('findusage.png'), 'Find highlighted item occurences', self) self.findButton.triggered.connect(self.__findWhereUsed) self.copyPathButton = QAction( PixmapCache().getIcon('copytoclipboard.png'), 'Copy path to clipboard', self) self.copyPathButton.triggered.connect( self.globalsViewer.copyToClipboard) self.findNotUsedButton = QAction(PixmapCache().getIcon('notused.png'), 'Unused global variable analysis', self) self.findNotUsedButton.triggered.connect(self.__findNotUsed) self.findNotUsedButton.setEnabled(False) self.toolbar = QToolBar(self) self.toolbar.setMovable(False) self.toolbar.setAllowedAreas(Qt.TopToolBarArea) self.toolbar.setIconSize(QSize(16, 16)) self.toolbar.setFixedHeight(28) self.toolbar.setContentsMargins(0, 0, 0, 0) self.toolbar.addAction(self.definitionButton) self.toolbar.addAction(self.findButton) self.toolbar.addAction(self.copyPathButton) filterLabel = QLabel(" Filter ") self.toolbar.addWidget(filterLabel) self.filterEdit = CDMComboBox(True, self.toolbar) self.filterEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.filterEdit.lineEdit().setToolTip( "Space separated regular expressions") self.toolbar.addWidget(self.filterEdit) self.toolbar.addAction(self.findNotUsedButton) self.filterEdit.editTextChanged.connect(self.__filterChanged) self.filterEdit.itemAdded.connect(self.__filterItemAdded) self.filterEdit.enterClicked.connect(self.__enterInFilter) layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) layout.addWidget(self.toolbar) layout.addWidget(self.globalsViewer) self.setLayout(layout) return
def createWidgets(self): """ QtWidgets creation """ self.dockToolbar = QToolBar(self) self.dockToolbar.setStyleSheet( "QToolBar { border: 0px }") # remove 3D border self.dockToolbar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.dockToolbarClipboard = QToolBar(self) self.dockToolbarClipboard.setStyleSheet( "QToolBar { border: 0px }") # remove 3D border self.dockToolbarClipboard.setToolButtonStyle( Qt.ToolButtonTextUnderIcon) self.clipBox = QGroupBox("Clipboard") self.clipBox.setStyleSheet(""" QGroupBox { font: normal; border: 1px solid silver; border-radius: 2px; } QGroupBox { padding-bottom: 10px; background-color: #FAFAFA; } QGroupBox::title { subcontrol-position: bottom center;} """) layoutClipBox = QHBoxLayout() layoutClipBox.addWidget(self.dockToolbarClipboard) layoutClipBox.setContentsMargins(0, 0, 0, 0) self.clipBox.setLayout(layoutClipBox) self.paramsBox = QGroupBox("Parameters") self.paramsBox.setStyleSheet(""" QGroupBox { font: normal; border: 1px solid silver; border-radius: 2px; } QGroupBox { padding-bottom: 10px; background-color: #FAFAFA; } QGroupBox::title { subcontrol-position: bottom center;} """) layoutParamBox = QHBoxLayout() layoutParamBox.addWidget(self.dockToolbar) layoutParamBox.setContentsMargins(0, 0, 0, 0) self.paramsBox.setLayout(layoutParamBox) layoutToolbars = QHBoxLayout() layoutToolbars.addWidget(self.paramsBox) layoutToolbars.addWidget(self.clipBox) layoutToolbars.addStretch(1) layoutToolbars.setContentsMargins(5, 0, 0, 0) title = QLabel("Test Config:") title.setStyleSheet("QLabel { padding-left: 2px; padding-top: 2px }") font = QFont() font.setBold(True) title.setFont(font) layout = QVBoxLayout() layout.addWidget(title) layout.addLayout(layoutToolbars) layout.addWidget(self.tc) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout)
def paintEvent(self, event ): if self._queuedWidget.pendingMessageCount() == 0 : QToolBar.paintEvent( self, event ) return brush = self._queuedWidget.currentMessageBackground() painter = QPainter( self ) painter.setPen( brush.color().darker( 150 ) ) painter.setBrush( brush ) painter.drawRect( self.contentsRect().adjusted( 0, 0, -1, -1 ) )
def __init__(self, parent=None): super(XCommentEdit, self).__init__(parent) # define custom properties self._attachments = {} self._showAttachments = True # create toolbar self._toolbar = QToolBar(self) self._toolbar.setMovable(False) self._toolbar.setFixedHeight(30) self._toolbar.setAutoFillBackground(True) self._toolbar.setFocusProxy(self) self._toolbar.hide() # create toolbar buttons self._attachButton = QToolButton(self) self._attachButton.setIcon(QIcon(resources.find('img/attach.png'))) self._attachButton.setToolTip('Add Attachment') self._attachButton.setAutoRaise(True) self._attachButton.setIconSize(QSize(24, 24)) self._attachButton.setFixedSize(26, 26) self._submitButton = QPushButton(self) self._submitButton.setText('Submit') self._submitButton.setFocusProxy(self) # create attachments widget self._attachmentsEdit = XMultiTagEdit(self) self._attachmentsEdit.setAutoResizeToContents(True) self._attachmentsEdit.setFrameShape(XMultiTagEdit.NoFrame) self._attachmentsEdit.setViewMode(XMultiTagEdit.ListMode) self._attachmentsEdit.setEditable(False) self._attachmentsEdit.setFocusProxy(self) self._attachmentsEdit.hide() # define toolbar layout spacer = QWidget(self) spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) self._attachAction = self._toolbar.addWidget(self._attachButton) self._toolbar.addWidget(spacer) self._toolbar.addWidget(self._submitButton) # set standard properties self.setAutoResizeToContents(True) self.setHint('add comment') self.setFocusPolicy(Qt.StrongFocus) self.setRequireShiftForNewLine(True) # create connections self._attachButton.clicked.connect(self.attachmentRequested) self._submitButton.clicked.connect(self.acceptText) self._attachmentsEdit.tagRemoved.connect(self.removeAttachment) self.focusChanged.connect(self.setToolbarVisible)
def test_dock(self): reg = global_registry() reg = QtWidgetRegistry(reg, parent=self.app) toolbox = WidgetToolBox() toolbox.setObjectName("widgets-toolbox") toolbox.setModel(reg.model()) text = QTextEdit() splitter = QSplitter() splitter.setOrientation(Qt.Vertical) splitter.addWidget(toolbox) splitter.addWidget(text) dock = CollapsibleDockWidget() dock.setExpandedWidget(splitter) toolbar = QToolBar() toolbar.addAction("1") toolbar.setOrientation(Qt.Vertical) toolbar.setMovable(False) toolbar.setFloatable(False) dock.setCollapsedWidget(toolbar) dock.show() self.app.exec_()
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, config_file_path): QWidget.__init__(self) layout = QVBoxLayout() toolbar = QToolBar("toolbar") # start_icon = toolbar.style().standardIcon(QStyle.SP_MediaPlay) # start_action = toolbar.addAction(start_icon, "Run simulations") # start_action.triggered.connect(self.start) # # toolbar.addSeparator() save_icon = toolbar.style().standardIcon(QStyle.SP_DialogSaveButton) save_action = toolbar.addAction(save_icon, "Save") save_action.triggered.connect(self.save) # reload_icon = toolbar.style().standardIcon(QStyle.SP_BrowserReload) # reload_action = toolbar.addAction(reload_icon, "Reload") # reload_action.triggered.connect(self.reload) toolbar.addSeparator() stretchy_separator = QWidget() stretchy_separator.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(stretchy_separator) search = SearchBox() search.setMaximumWidth(200) search.setContentsMargins(5, 2, 5, 2) toolbar.addWidget(search) layout.addWidget(toolbar) self.ide_panel = IdePanel() layout.addWidget(self.ide_panel, 1) self.config_file_path = config_file_path with open(config_file_path) as f: config_file_text = f.read() self.highlighter = KeywordHighlighter(self.ide_panel.document()) search.filterChanged.connect(self.highlighter.setSearchString) self.ide_panel.document().setPlainText(config_file_text) cursor = self.ide_panel.textCursor() cursor.setPosition(0) self.ide_panel.setTextCursor(cursor) self.ide_panel.setFocus() self.setLayout(layout)
def createWidget(self): """ Create qt widget """ self.screenResolutionLabel = QLabel(self) self.screenTapLabel = QLabel(self) mobileLayout = QVBoxLayout() self.mobileDockToolbar = QToolBar(self) self.mobileDockToolbar.setStyleSheet("QToolBar { border: 0px }"); self.mobileDockToolbar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.mobileImageLabel = QLabel(self) self.mobileImageLabel.setMouseTracking(True) self.mobileImageLabel.installEventFilter(self) self.mobileImageLabel.setScaledContents(True) self.mobileImageLabel.mousePressEvent = self.pixelSelect self.refreshCheckbox = QCheckBox("Automatic Refresh", self) self.refreshCheckbox.setEnabled(False) self.refreshCheckbox.stateChanged.connect(self.onRefreshChanged) self.clickCheckbox = QCheckBox("Enable Tap", self) self.clickCheckbox.setEnabled(False) self.model = DomModel(QDomDocument(), self) self.mobileTreeView = QTreeView(self) self.mobileTreeView.setMinimumWidth(300) self.mobileTreeView.setModel(self.model) self.mobileTreeView.clicked.connect(self.onTreeViewClicked) header=["Attribute", "Value"] self.tableModel = MyTableModel(self, [], header) self.mobileTableView = QTableView(self) self.mobileTableView.setSelectionMode(QAbstractItemView.SingleSelection) self.mobileTableView.setModel(self.tableModel) self.mobileTableView.setContextMenuPolicy(Qt.CustomContextMenu) self.mobileTableView.customContextMenuRequested.connect( self.onContextMenuEvent ) self.mobileTableView.setMinimumWidth(300) mobileViewLayout = QHBoxLayout() mobileViewLayout.addWidget(self.mobileImageLabel) mobileViewLayout.addWidget(self.mobileTreeView) mobileViewLayout.addWidget(self.mobileTableView) mobileLayout.addWidget(self.mobileDockToolbar) mobileLayout.addLayout(mobileViewLayout) self.setLayout(mobileLayout)
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, 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 create_widgets(self): self.backAction = QAction(QIcon(":/back.png"), self.tr("&Back"), self) self.backAction.setShortcut(QKeySequence.Back) self.homeAction = QAction(QIcon(":/home.png"), self.tr("&Home"), self) self.homeAction.setShortcut(self.tr("Home")) self.pageLabel = QLabel() self.toolBar = QToolBar() self.toolBar.addAction(self.backAction) self.toolBar.addAction(self.homeAction) self.toolBar.addWidget(self.pageLabel) self.textBrowser = QTextBrowser()
def create_widgets(self): self.backAction = QAction(QIcon(":/back.png"), "&Atras", self) self.backAction.setShortcut(QKeySequence.Back) self.homeAction = QAction(QIcon(":/home.png"), "&Inicio", self) self.homeAction.setShortcut("Inicio") self.pageLabel = QLabel() self.toolBar = QToolBar() self.toolBar.addAction(self.backAction) self.toolBar.addAction(self.homeAction) self.toolBar.addWidget(self.pageLabel) self.textBrowser = QTextBrowser()
def __init__(self, wintitle='Plot window', major_grid=True, minor_grid=False, toolbar=True, parent=None, panels=None, min_plot_width=100, min_plot_height=75): QDialog.__init__(self, parent) self.setWindowFlags(Qt.Window) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(_fromUtf8(':/Application/Main')), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.setWindowIcon(icon) self.major_grid = major_grid self.minor_grid = minor_grid self.min_plot_width = min_plot_width self.min_plot_height = min_plot_height # WidgetMixin copy PlotManager.__init__(self, main=self) self.main_layout = QVBoxLayout(self) self.color_layout = QHBoxLayout() self.plot_layout = QGridLayout() self.plot_layout.setMargin(0) self.plot_scroll_widget = QWidget() self.plot_scroll_area = QScrollArea() self.plot_scroll_area.setFrameShape(QFrame.NoFrame) self.plot_scroll_area.setWidgetResizable(True) self.option_layout = QHBoxLayout() self.plot_widget = None if panels is not None: for panel in panels: self.add_panel(panel) self.toolbar = QToolBar('Tools') if not toolbar: self.toolbar.hide() # Configuring widget layout self._setup_widget_properties(wintitle=wintitle, icon=icon) self._setup_widget_layout() # Options self.option_callbacks = {} self.legend = None self.axis_syncplots = {}
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=None): QWidget.__init__(self, parent) vbox = QVBoxLayout(self) vbox.setContentsMargins(0, 0, 0, 0) vbox.setSpacing(0) self.__toolbar = QToolBar() vbox.addWidget(self.__toolbar) self.stack = StackedWidget() vbox.addWidget(self.stack) self._console = console_widget.ConsoleWidget() self.stack.addWidget(self._console) self._runWidget = run_widget.RunWidget() self.stack.addWidget(self._runWidget) self._web = web_render.WebRender() self.stack.addWidget(self._web) self._findInFilesWidget = find_in_files.FindInFilesWidget( self.parent()) self.stack.addWidget(self._findInFilesWidget) #Last Element in the Stacked widget self._results = results.Results(self) self.stack.addWidget(self._results) self._btnConsole = QPushButton(QIcon(resources.IMAGES['console']), '') self._btnConsole.setToolTip(self.tr("Console")) self._btnRun = QPushButton(QIcon(resources.IMAGES['play']), '') self._btnRun.setToolTip(self.tr("Output")) self._btnWeb = QPushButton(QIcon(resources.IMAGES['web']), '') self._btnWeb.setToolTip(self.tr("Web Preview")) self._btnFind = QPushButton(QIcon(resources.IMAGES['find']), '') self._btnFind.setToolTip(self.tr("Find in Files")) self.__toolbar.addWidget(self._btnConsole) self.__toolbar.addWidget(self._btnRun) self.__toolbar.addWidget(self._btnWeb) self.__toolbar.addWidget(self._btnFind) self.connect(self._btnConsole, SIGNAL("clicked()"), lambda: self._item_changed(0)) self.connect(self._btnRun, SIGNAL("clicked()"), lambda: self._item_changed(1)) self.connect(self._btnWeb, SIGNAL("clicked()"), lambda: self._item_changed(2)) self.connect(self._btnFind, SIGNAL("clicked()"), lambda: self._item_changed(3))
def initGui(self): for keyseq, slot in ( (Qt.CTRL + Qt.ALT + Qt.Key_K, self.__create_group), (Qt.CTRL + Qt.ALT + Qt.Key_S, self.__select_next_group), (Qt.CTRL + Qt.ALT + Qt.Key_N, self.__next_section), (Qt.CTRL + Qt.ALT + Qt.Key_B, self.__previous_section) ): short = QShortcut(QKeySequence(keyseq), self.__iface.mainWindow()) short.setContext(Qt.ApplicationShortcut) short.activated.connect(slot) self.__shortcuts.append(short) self.__menu = QMenu("Albion") self.__menu.aboutToShow.connect(self.__create_menu_entries) self.__iface.mainWindow().menuBar().addMenu(self.__menu) self.__toolbar = QToolBar('Albion') self.__iface.addToolBar(self.__toolbar) self.__toolbar.addAction(icon('log_strati.svg'), 'stratigraphic log').triggered.connect(self.__log_strati_clicked) self.__toolbar.addWidget(self.__current_graph) self.__current_graph.currentIndexChanged[unicode].connect(self.__current_graph_changed) self.__toolbar.addWidget(self.__current_section) self.__current_section.currentIndexChanged[unicode].connect(self.__current_section_changed) self.__toolbar.addAction(icon('previous_line.svg'), 'previous section (Ctrl+Alt+b)').triggered.connect(self.__previous_section) self.__toolbar.addAction(icon('next_line.svg'), 'next section (Ctrl+Alt+n)').triggered.connect(self.__next_section) self.__toolbar.addAction(icon('line_from_selected.svg'), 'create temporary section').triggered.connect(self.__section_from_selection) self.__viewer3d = QDockWidget('3D') self.__viewer3d.setWidget(Viewer3d()) self.__iface.addDockWidget(Qt.LeftDockWidgetArea, self.__viewer3d) self.__iface.mainWindow().tabifyDockWidget( self.__iface.mainWindow().findChild(QDockWidget, "Layers"), self.__viewer3d) self.__viewer3d_ctrl = QToolBar('3D controls') self.__viewer3d_ctrl.addWidget(ViewerControls(self.__viewer3d.widget())) self.__iface.addToolBar(self.__viewer3d_ctrl) QgsProject.instance().readProject.connect(self.__qgis__project__loaded) self.__qgis__project__loaded() # case of reload
def __createLayout(self, parent): " Helper to create the viewer layout " # Messages list area self.messages = QPlainTextEdit(parent) self.messages.setLineWrapMode(QPlainTextEdit.NoWrap) self.messages.setFont(QFont(GlobalData().skin.baseMonoFontFace)) self.messages.setReadOnly(True) self.messages.setMaximumBlockCount(MAX_LINES) # Default font size is good enough for most of the systems. # 12.0 might be good only in case of the XServer on PC (Xming). # self.messages.setFontPointSize( 12.0 ) # Buttons self.selectAllButton = QAction(PixmapCache().getIcon('selectall.png'), 'Select all', self) self.selectAllButton.triggered.connect(self.messages.selectAll) self.copyButton = QAction(PixmapCache().getIcon('copytoclipboard.png'), 'Copy to clipboard', self) self.copyButton.triggered.connect(self.messages.copy) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.clearButton = QAction(PixmapCache().getIcon('trash.png'), 'Clear all', self) self.clearButton.triggered.connect(self.__clear) # Toolbar self.toolbar = QToolBar() self.toolbar.setOrientation(Qt.Vertical) self.toolbar.setMovable(False) self.toolbar.setAllowedAreas(Qt.LeftToolBarArea) self.toolbar.setIconSize(QSize(16, 16)) self.toolbar.setFixedWidth(28) self.toolbar.setContentsMargins(0, 0, 0, 0) self.toolbar.addAction(self.selectAllButton) self.toolbar.addAction(self.copyButton) self.toolbar.addWidget(spacer) self.toolbar.addAction(self.clearButton) # layout layout = QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) layout.addWidget(self.toolbar) layout.addWidget(self.messages) self.setLayout(layout) return
def createGUI(self): ## help tool bar self.toolBar = QToolBar(self) ## help text Browser self.textBrowser = QTextBrowser(self) layout = QVBoxLayout(self) layout.addWidget(self.toolBar) layout.addWidget(self.textBrowser, 1) self.setLayout(layout) self.textBrowser.setSearchPaths([":/help"]) self.textBrowser.setSource(QUrl(self._page)) self.resize(660, 700) self.setWindowTitle("%s Help" % (QApplication.applicationName()))
def setup_ui(self): """Load all the components of the ui during the install process.""" vbox = QVBoxLayout(self) vbox.setContentsMargins(0, 0, 0, 0) vbox.setSpacing(0) self.__toolbar = QToolBar() self.__toolbar.setObjectName('custom') hbox = QHBoxLayout() vbox.addLayout(hbox) self.stack = StackedWidget() vbox.addWidget(self.stack) self._console = console_widget.ConsoleWidget() self._runWidget = run_widget.RunWidget() self._web = web_render.WebRender() self._findInFilesWidget = find_in_files.FindInFilesWidget( self.parent()) # Not Configurable Shortcuts shortEscMisc = QShortcut(QKeySequence(Qt.Key_Escape), self) self.connect(shortEscMisc, SIGNAL("activated()"), self.hide) #Toolbar hbox.addWidget(self.__toolbar) self.add_to_stack(self._console, ":img/console", translations.TR_CONSOLE) self.add_to_stack(self._runWidget, ":img/play", translations.TR_OUTPUT) self.add_to_stack(self._web, ":img/web", translations.TR_WEB_PREVIEW) self.add_to_stack(self._findInFilesWidget, ":img/find", translations.TR_FIND_IN_FILES) #Last Element in the Stacked widget self._results = results.Results(self) self.stack.addWidget(self._results) self.__toolbar.addSeparator() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) btn_close = QPushButton( self.style().standardIcon(QStyle.SP_DialogCloseButton), '') btn_close.setIconSize(QSize(24, 24)) btn_close.setObjectName('navigation_button') btn_close.setToolTip('F4: ' + translations.TR_ALL_VISIBILITY) hbox.addWidget(btn_close) self.connect(btn_close, SIGNAL('clicked()'), self.hide)
def __init__( self, parent=None, name_filters=["*.py", "*.pyw"], valid_types=(".py", ".pyw"), show_all=False, show_cd_only=None, show_toolbar=True, show_icontext=True, ): QWidget.__init__(self, parent) self.treewidget = ExplorerTreeWidget(self, show_cd_only=show_cd_only) self.treewidget.setup(name_filters=name_filters, valid_types=valid_types, show_all=show_all) self.treewidget.chdir(os.getcwdu()) toolbar_action = create_action(self, _("Show toolbar"), toggled=self.toggle_toolbar) icontext_action = create_action(self, _("Show icons and text"), toggled=self.toggle_icontext) self.treewidget.common_actions += [None, toolbar_action, icontext_action] # Setup toolbar self.toolbar = QToolBar(self) self.toolbar.setIconSize(QSize(16, 16)) self.previous_action = create_action( self, text=_("Previous"), icon=get_icon("previous.png"), triggered=self.treewidget.go_to_previous_directory ) self.toolbar.addAction(self.previous_action) self.previous_action.setEnabled(False) self.connect(self.treewidget, SIGNAL("set_previous_enabled(bool)"), self.previous_action.setEnabled) self.next_action = create_action( self, text=_("Next"), icon=get_icon("next.png"), triggered=self.treewidget.go_to_next_directory ) self.toolbar.addAction(self.next_action) self.next_action.setEnabled(False) self.connect(self.treewidget, SIGNAL("set_next_enabled(bool)"), self.next_action.setEnabled) parent_action = create_action( self, text=_("Parent"), icon=get_icon("up.png"), triggered=self.treewidget.go_to_parent_directory ) self.toolbar.addAction(parent_action) options_action = create_action(self, text="", tip=_("Options"), icon=get_icon("tooloptions.png")) self.toolbar.addAction(options_action) widget = self.toolbar.widgetForAction(options_action) widget.setPopupMode(QToolButton.InstantPopup) menu = QMenu(self) add_actions(menu, self.treewidget.common_actions) options_action.setMenu(menu) toolbar_action.setChecked(show_toolbar) self.toggle_toolbar(show_toolbar) icontext_action.setChecked(show_icontext) self.toggle_icontext(show_icontext) vlayout = QVBoxLayout() vlayout.addWidget(self.toolbar) vlayout.addWidget(self.treewidget) self.setLayout(vlayout)
def __init__(self, data, scheme, parent=None): super(NodeWindow, self).__init__(parent) self.pathWidget = PathWidget(self.openWidgetByPath, data.path()) self.setStatusBar(self.pathWidget) # layout_set_sm_and_mrg(self.layout) self.cachedWidgets = {} self.currentStructuredWidget = None self.stacked = QStackedWidget(self) self.setCentralWidget(self.stacked) self.data, self.scheme = data, scheme self.data.add_set_notify(self.change_caption) self.toolbar = QToolBar() self.toolbar.addActions((self.parent().actionSave,self.parent().actionSaveAs,)) self.addToolBar(self.toolbar) self.setUnifiedTitleAndToolBarOnMac(True) self.messageBoxChanged = None self.reallyQuit = False self.change_caption() if "ExcelScheme" in self.scheme.get_meta(): actionExcelExport = QAction("Export to excel", self) self.toolbar.addAction(actionExcelExport) actionExcelExport.triggered.connect(self.excel_export) actionExcelMerge = QAction("Merge from excel", self) actionExcelMerge.triggered.connect(self.excel_import) self.toolbar.addAction(actionExcelMerge) self.tree_widget = DataTreeWidget(self.data, self) dock = QDockWidget(self) dock.setWidget(self.tree_widget) self.addDockWidget(Qt.LeftDockWidgetArea, dock) self.tree_widget.pathChanged.connect(self._open_widget_by_path) self.openWidgetByPath(Path())
def initToolBar(self): self._toolbar = QToolBar(QString("Blooploads"),self.parent()) from controllers.ActionManager import ActionManager uploadManagerActions = ActionManager.getInstance().getBloopUploadManagerActions() for action in uploadManagerActions: self._toolbar.addAction(action)
def createWidgets(self): """ Create qt widgets """ layout = QVBoxLayout() self.dockToolbar = QToolBar(self) self.dockToolbar.setStyleSheet("QToolBar { border: 0px; }") # remove 3D border self.agentsTable = AgentsTableView(self) layout.addWidget(self.agentsTable) layout.addWidget(self.dockToolbar) layout.setContentsMargins(0,0,0,0) self.setLayout(layout)
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, wintitle="guiqwt plot", icon="guiqwt.png", toolbar=False, options=None, parent=None, panels=None): QDialog.__init__(self, parent) self.setWindowFlags(Qt.Window) # WidgetMixin copy PlotManager.__init__(self, main=self) self.main_layout = QVBoxLayout(self) self.color_layout = QHBoxLayout() self.plot_layout = QGridLayout() self.option_layout = QHBoxLayout() self.plot_widget = None if panels is not None: for panel in panels: self.add_panel(panel) self.toolbar = QToolBar(_("Tools")) if not toolbar: self.toolbar.hide() # Configuring widget layout self._setup_widget_properties(wintitle=wintitle, icon=icon) self._setup_widget_layout() # Options self.option_callbacks = {} self.legend = None
def createActions(self): self.actions = QToolBar() self.actions.setObjectName("Image viewer actions") self.nextButton = QAction(QIcon(":next.png"), "Display next image", self.actions) self.previousButton = QAction(QIcon(":previous.png"), "Display previous image", self.actions) self.rotlButton = QAction(QIcon(":rotate-left.png"), "Rotate the image 90 degrees to the left", self.actions) self.rotrButton = QAction(QIcon(":rotate-right.png"), "Rotate the image 90 degrees to the right", self.actions) self.enlargeButton = QAction(QIcon(":viewmag+"), "Enlarge the image", self.actions) self.shrinkButton = QAction(QIcon(":viewmag-"), "Shrink the image", self.actions) self.fitButton = QAction(QIcon(":viewmagfit"), "Fit the image to the window", self.actions) self.normalButton = QAction(QIcon(":viewmag1"), "Show the image at its normal size", self.actions) self.actions.addAction(self.previousButton) self.actions.addAction(self.nextButton) self.actions.addAction(self.rotlButton) self.actions.addAction(self.rotrButton) self.actions.addAction(self.enlargeButton) self.actions.addAction(self.shrinkButton) self.actions.addAction(self.fitButton) self.actions.addAction(self.normalButton) self.connect(self.loadedImage, SIGNAL("available(bool)"), self.enableActions) self.connect(self.previousButton, SIGNAL("triggered()"), self.previous) self.connect(self.nextButton, SIGNAL("triggered()"), self.next) self.connect(self.rotlButton, SIGNAL("triggered()"), self.loadedImage.rotateLeft) self.connect(self.rotrButton, SIGNAL("triggered()"), self.loadedImage.rotateRight) self.connect(self.enlargeButton, SIGNAL("triggered()"), self.loadedImage.enlarge) self.connect(self.shrinkButton, SIGNAL("triggered()"), self.loadedImage.shrink) self.connect(self.fitButton, SIGNAL("triggered()"), self.loadedImage.fit) self.connect(self.normalButton, SIGNAL("triggered()"), self.loadedImage.normal)
def __init__(self): QWidget.__init__(self) self.setLayout(QVBoxLayout()) self.view = QWebView() self.layout().addWidget(self.view) self.toolbar = QToolBar() self.config = False if os.path.isfile('config/Skywind.yml'): self.view.setHtml(self.getReadme('Skywind')) button = QToolButton() button.setIcon(QIcon(icons_folder + 'Skywind_icon.png')) button.clicked.connect(lambda: self.view.setHtml(self.getReadme('Skywind'))) self.toolbar.addWidget(button) if os.path.isfile('config/Skyblivion.yml'): if not self.config: self.view.setHtml(self.getReadme('Skyblivion')) button = QToolButton() button.setIcon(QIcon(icons_folder + 'Skyblivion_icon.png')) button.clicked.connect(lambda: self.view.setHtml(self.getReadme('Skyblivion'))) self.toolbar.addWidget(button)
def __init__(self, parent): super(HtmlViewerWidget, self).__init__(parent) self.setLayout(QGridLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.view = QWebView() self.view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks) self.frame = QFrame() self.frame.setLayout(QGridLayout()) self.frame.layout().setContentsMargins(0, 0, 0, 0) self.toolbar = QToolBar() self.spacer = QWidget() self.spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.copyAction = self.toolbar.addAction(QIcon(":/icons/clipboard"), "Copy Text") self.label = QLabel() self.closeAction = self.toolbar.addAction(QIcon(":/icons/cancel"), "Close") self.spaceraction = self.toolbar.insertWidget(self.closeAction, self.spacer) self.labelaction = self.toolbar.insertWidget(self.spaceraction, self.label) self.closeAction.triggered.connect(self.close) self.copyAction.triggered.connect(self.copy_text) self.layout().addWidget(self.frame) self.frame.layout().addWidget(self.toolbar) self.frame.layout().addWidget(self.view) self.effect = QGraphicsOpacityEffect() self.label.setGraphicsEffect(self.effect) self.anim = QPropertyAnimation(self.effect, "opacity") self.anim.setDuration(2000) self.anim.setStartValue(1.0) self.anim.setEndValue(0.0) self.anim.setEasingCurve(QEasingCurve.OutQuad )
class HelpForm(QDialog): def __init__(self, page, parent=None): super(HelpForm, self).__init__(parent) self.setAttribute(Qt.WA_DeleteOnClose) self.setAttribute(Qt.WA_GroupLeader) self.create_widgets() self.layout_widgets() self.create_connections() self.textBrowser.setSearchPaths([":/"]) self.textBrowser.setSource(QUrl(page)) self.resize(400, 600) self.setWindowTitle(self.tr("%1 Help").arg( QApplication.applicationName())) def create_widgets(self): self.backAction = QAction(QIcon(":/back.png"), self.tr("&Back"), self) self.backAction.setShortcut(QKeySequence.Back) self.homeAction = QAction(QIcon(":/home.png"), self.tr("&Home"), self) self.homeAction.setShortcut(self.tr("Home")) self.pageLabel = QLabel() self.toolBar = QToolBar() self.toolBar.addAction(self.backAction) self.toolBar.addAction(self.homeAction) self.toolBar.addWidget(self.pageLabel) self.textBrowser = QTextBrowser() def layout_widgets(self): layout = QVBoxLayout() layout.addWidget(self.toolBar) layout.addWidget(self.textBrowser, 1) self.setLayout(layout) def create_connections(self): self.backAction.triggered.connect(self.textBrowser.backward) self.homeAction.triggered.connect(self.textBrowser.home) self.textBrowser.sourceChanged.connect(self.updatePageTitle) def updatePageTitle(self): self.pageLabel.setText(self.textBrowser.documentTitle())
class HtmlViewerWidget(QWidget): def __init__(self, parent): super(HtmlViewerWidget, self).__init__(parent) self.setLayout(QGridLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.view = QWebView() self.view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks) self.frame = QFrame() self.frame.setLayout(QGridLayout()) self.frame.layout().setContentsMargins(0, 0, 0, 0) self.toolbar = QToolBar() self.spacer = QWidget() self.spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.copyAction = self.toolbar.addAction(QIcon(":/icons/clipboard"), "Copy Text") self.label = QLabel() self.closeAction = self.toolbar.addAction(QIcon(":/icons/cancel"), "Close") self.spaceraction = self.toolbar.insertWidget(self.closeAction, self.spacer) self.labelaction = self.toolbar.insertWidget(self.spaceraction, self.label) self.closeAction.triggered.connect(self.close) self.copyAction.triggered.connect(self.copy_text) self.layout().addWidget(self.frame) self.frame.layout().addWidget(self.toolbar) self.frame.layout().addWidget(self.view) self.effect = QGraphicsOpacityEffect() self.label.setGraphicsEffect(self.effect) self.anim = QPropertyAnimation(self.effect, "opacity") self.anim.setDuration(2000) self.anim.setStartValue(1.0) self.anim.setEndValue(0.0) self.anim.setEasingCurve(QEasingCurve.OutQuad) def copy_text(self): self.label.setText("Copied to clipboard") text = self.view.page().mainFrame().toPlainText() QApplication.clipboard().setText(text) self.anim.stop() self.anim.start() def showHTML(self, template, level, **data): html = templates.render_tample(template, **data) self.view.setHtml(html, templates.baseurl)
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): QMainWindow.__init__(self) self._queuedMessageToolBar = None self._createdMenuPathes = [] self._createdActions = [] self._addedDockWidgets = [] self.setUnifiedTitleAndToolBarOnMac(True) self.setIconSize(QSize(16, 16)) self.setAcceptDrops(True) # Set corner settings for dock widgets self.setCorner(Qt.TopLeftCorner, Qt.LeftDockWidgetArea) self.setCorner(Qt.TopRightCorner, Qt.RightDockWidgetArea) self.setCorner(Qt.BottomLeftCorner, Qt.LeftDockWidgetArea) self.setCorner(Qt.BottomRightCorner, Qt.RightDockWidgetArea) self.setWindowTitle(self.defaultTitle( )) # overwriten by workspace when file or it's modified state changes self.setWindowIcon(QIcon(':/enkiicons/logo/enki.svg')) # Create top tool bar self._topToolBar = QToolBar("topToolBar") self._topToolBar.setObjectName("topToolBar") self._topToolBar.setMovable(False) self._topToolBar.setIconSize(QSize(16, 16)) self._topToolBar.setContextMenuPolicy( Qt.PreventContextMenu) # to avoid possibility to hide the toolbar # Create menu bar self._menuBar = ActionMenuBar(self, core.actionManager()) self._initMenubarAndStatusBarLayout() self._createMenuStructure() core.actionManager().action('mView/aOpenMainMenu').triggered.connect( self._openMainMenu) # create central layout widget = QWidget(self) self._centralLayout = QVBoxLayout(widget) self._centralLayout.setMargin(0) self.setCentralWidget(widget)
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)