我们从Python开源项目中,提取了以下30个代码示例,用于说明如何使用PyQt5.QtWidgets.QToolBar()。
def optics(self): toolbar = QToolBar() toolbar.setToolButtonStyle( Qt.ToolButtonTextUnderIcon) toolbar.setIconSize(QSize(42, 42)) self.run = QAction(QIcon_load("media-playback-start"), wrap_text(_("Calculate"),5), self) toolbar.addAction(self.run) self.export = QAction(QIcon_load("document-export"), wrap_text(_("Export spectrum"),5), self) #self.export.triggered.connect(self.save_image) toolbar.addAction(self.export) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.help = QAction(QIcon_load("help"), _("Help"), self) toolbar.addAction(self.help) return toolbar
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(564, 270) self.centralWidget = QtWidgets.QWidget(MainWindow) self.centralWidget.setObjectName("centralWidget") self.pushButton = QtWidgets.QPushButton(self.centralWidget) self.pushButton.setGeometry(QtCore.QRect(320, 60, 93, 28)) self.pushButton.setObjectName("pushButton") self.textEdit = QtWidgets.QTextEdit(self.centralWidget) self.textEdit.setGeometry(QtCore.QRect(60, 60, 151, 31)) self.textEdit.setObjectName("textEdit") self.pushButton_2 = QtWidgets.QPushButton(self.centralWidget) self.pushButton_2.setGeometry(QtCore.QRect(320, 150, 111, 28)) self.pushButton_2.setObjectName("pushButton_2") self.label = QtWidgets.QLabel(self.centralWidget) self.label.setGeometry(QtCore.QRect(60, 30, 151, 16)) self.label.setObjectName("label") self.label_2 = QtWidgets.QLabel(self.centralWidget) self.label_2.setGeometry(QtCore.QRect(60, 110, 151, 41)) self.label_2.setObjectName("label_2") self.comboBox = QtWidgets.QComboBox(self.centralWidget) self.comboBox.setGeometry(QtCore.QRect(60, 160, 87, 22)) self.comboBox.setObjectName("comboBox") MainWindow.setCentralWidget(self.centralWidget) self.menuBar = QtWidgets.QMenuBar(MainWindow) self.menuBar.setGeometry(QtCore.QRect(0, 0, 564, 26)) self.menuBar.setObjectName("menuBar") MainWindow.setMenuBar(self.menuBar) self.mainToolBar = QtWidgets.QToolBar(MainWindow) self.mainToolBar.setObjectName("mainToolBar") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar) self.statusBar = QtWidgets.QStatusBar(MainWindow) self.statusBar.setObjectName("statusBar") MainWindow.setStatusBar(self.statusBar) self.comboBox.addItems(["%s" % x for x in range(1, 100)]) self.pushButton.clicked.connect(self.start) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def finder_toolbar(self): self.finder_toolbar = QtWidgets.QToolBar() self.finder_toolbar.setAllowedAreas(QtCore.Qt.TopToolBarArea) self.finder_toolbar.setHidden(True) self.finder_toolbar.setFloatable(True) self.finder_tool() self.finder_toolbar.addWidget(self.finder) btn_close = QtWidgets.QToolButton() btn_close.setIcon(QtGui.QIcon('assets/icons/close.png')) btn_close.setFixedSize(16, 16) btn_close.clicked.connect(self.finder_toolbar.hide) self.finder_toolbar.addWidget(btn_close) self.addToolBar(self.finder_toolbar) self.finder_focus()
def get_toolbar(self, parent=None) -> QtWidgets.QToolBar: """ Get a Matplotlib Toolbar for the current plot instance, and set toolbar actions (pan/zoom) specific to this plot. Parameters ---------- [parent] Optional Qt Parent for this object Returns ------- QtWidgets.QToolBar : Matplotlib Qt Toolbar used to control this plot instance """ toolbar = NavigationToolbar(self, parent=parent) toolbar.actions()[4].triggered.connect(self.toggle_pan) toolbar.actions()[5].triggered.connect(self.toggle_zoom) return toolbar
def __init__(self, trace, parent=None): QtWidgets.QToolBar.__init__(self, parent=parent) vtrace.Notifier.__init__(self) self.trace = trace self.setObjectName('VtraceToolbar') self.attach_action = self.addAction('attach') self.attach_action.setToolTip('Attach to a process') self.attach_action.triggered.connect(self.actAttach) self.detach_action = self.addAction('detach') self.detach_action.setToolTip('Detach from current process') self.detach_action.triggered.connect(self.actDetach) self.continue_action = self.addAction('continue') self.continue_action.setToolTip('Continue current process') self.continue_action.triggered.connect(self.actContinue) self.break_action = self.addAction('break') self.break_action.setStatusTip('Break current process') self.break_action.triggered.connect(self.actBreak) self.stepi_action = self.addAction('stepi') self.stepi_action.setToolTip('Single step the current process') self.stepi_action.triggered.connect(self.actStepi) self.stepover_action = self.addAction('stepover') self.stepover_action.setToolTip('step over current instruction') self.stepover_action.triggered.connect(self.actStepover) trace.registerNotifier(NOTIFY_ALL, self) self._updateActions(trace.isAttached(), trace.isRunning())
def __init__(self,index): QWidget.__init__(self) vbox=QVBoxLayout() self.index=index toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) self.load_type=tb_pulse_load_type(self.index) #self.load_type.connect("changed", self.draw_callback) toolbar.addWidget(self.load_type) vbox.addWidget(toolbar) self.diode = QPixmap(os.path.join(get_image_file_path(),"diode.png")) self.ideal_diode = QPixmap(os.path.join(get_image_file_path(),"ideal_diode.png")) self.load = QPixmap(os.path.join(get_image_file_path(),"load.png")) self.ideal_load = QPixmap(os.path.join(get_image_file_path(),"ideal_load.png")) self.voc = QPixmap(os.path.join(get_image_file_path(),"voc.png")) self.darea = QWidget() vbox.addWidget(self.darea) self.setLayout(vbox) self.load_type.changed.connect(self.repaint) return
def __init__(self): QWidgetSavePos.__init__(self,"cost") self.setFixedSize(900, 600) self.setWindowIcon(QIcon_load("jv")) self.setWindowTitle(_("Cost and energy payback calculator")) self.main_vbox = QVBoxLayout() toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) self.play = QAction(QIcon_load("media-playback-start"), _("Re-calcualte"), self) self.play.triggered.connect(self.update) toolbar.addAction(self.play) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.help = QAction(QIcon_load("help"), _("Help"), self) self.help.triggered.connect(self.callback_help) toolbar.addAction(self.help) self.main_vbox.addWidget(toolbar) self.tab= QTableWidget() self.main_vbox.addWidget(self.tab) self.setLayout(self.main_vbox) self.update()
def __init__(self): QWidget.__init__(self) self.setWindowTitle(_("Quantum Efficiency calculator")+" - (www.gpvdm.com)") self.setWindowIcon(QIcon_load("qe")) self.fig = Figure(figsize=(5,4), dpi=100) self.ax1=None self.show_key=True self.draw_graph() canvas = FigureCanvas(self.fig) #canvas.set_background('white') #canvas.set_facecolor('white') canvas.figure.patch.set_facecolor('white') #canvas.set_size_request(500, 150) #canvas.show() toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) self.tb_save = QAction(QIcon_load("document-save-as"), _("Save graph"), self) self.tb_save.triggered.connect(self.callback_save) toolbar.addAction(self.tb_save) self.tb_refresh = QAction(QIcon_load("media-playback-start"), _("Run"), self) self.tb_refresh .triggered.connect(self.callback_refresh) toolbar.addAction(self.tb_refresh ) nav_bar=NavigationToolbar(canvas,self) toolbar.addWidget(nav_bar) window_main_vbox=QVBoxLayout() window_main_vbox.addWidget(toolbar) window_main_vbox.addWidget(canvas) self.setLayout(window_main_vbox)
def optics(self): toolbar = QToolBar() toolbar.setToolButtonStyle( Qt.ToolButtonTextUnderIcon) toolbar.setIconSize(QSize(42, 42)) self.run = QAction(QIcon_load("media-playback-start"), wrap_text(_("Run optical simulation"),5), self) toolbar.addAction(self.run) self.tb_save = QAction(QIcon_load("document-save-as"), _("Save graph"), self) #self.tb_save.triggered.connect(self.save_image) toolbar.addAction(self.tb_save) self.fx_box=fx_selector() self.fx_box.show_all=True self.fx_box.file_name_set_start("light_1d_") self.fx_box.file_name_set_end("_photons_abs.dat") self.fx_box.update() toolbar.addWidget(self.fx_box) self.optial_model=tb_optical_model() toolbar.addWidget(self.optial_model) self.spectrum=tb_spectrum() toolbar.addWidget(self.spectrum) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.help = QAction(QIcon_load("help"), _("Help"), self) toolbar.addAction(self.help) return toolbar
def measurement(self): toolbar = QToolBar() toolbar.setToolButtonStyle( Qt.ToolButtonTextUnderIcon) toolbar.setIconSize(QSize(42, 42)) self.tb_new = QAction(QIcon_load("document-new"), wrap_text(_("New measurement"),2), self) toolbar.addAction(self.tb_new) self.tb_delete = QAction(QIcon_load("edit-delete"), wrap_text(_("Delete measurement"),3), self) toolbar.addAction(self.tb_delete) self.tb_clone = QAction(QIcon_load("clone"), wrap_text(_("Clone measurement"),3), self) toolbar.addAction(self.tb_clone) self.tb_rename = QAction(QIcon_load("rename"), wrap_text(_("Rename measurement"),3), self) toolbar.addAction(self.tb_rename) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.home_help = QAction(QIcon_load("internet-web-browser"), _("Help"), self) toolbar.addAction(self.home_help) return toolbar
def __init__(self,file_name,name): QGroupBox.__init__(self) self.file_name=file_name self.name=name self.setTitle(name) self.setStyleSheet("QGroupBox { border: 1px solid gray;}") vbox=QVBoxLayout() self.setLayout(vbox) toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) add = QAction(QIcon_load("list-add",size=16), _("Add "+self.name+" mesh layer"), self) add.triggered.connect(self.add_item_clicked) toolbar.addAction(add) remove = QAction(QIcon_load("list-remove",size=16), _("Remove "+self.name+" mesh layer"), self) remove.triggered.connect(self.on_remove_click) toolbar.addAction(remove) vbox.addWidget(toolbar) self.tab = QTableWidget() self.tab.resizeColumnsToContents() self.tab.verticalHeader().setVisible(False) self.tab.clear() self.tab.setColumnCount(5) self.tab.setSelectionBehavior(QAbstractItemView.SelectRows) self.load() self.tab.cellChanged.connect(self.tab_changed) vbox.addWidget(self.tab)
def __init__(self): QWidget.__init__(self) self.updating=False #self.setMinimumSize(900, 600) self.setWindowIcon(QIcon_load("connected")) self.setWindowTitle(_("Cluster status (www.gpvdm.com)")) self.myserver=server_get() self.node_view=QWidget() self.node_view_vbox=QVBoxLayout() self.node_view.setLayout(self.node_view_vbox) self.main_vbox = QVBoxLayout() self.tool_bar=QToolBar() self.tool_bar.setIconSize(QSize(42, 42)) self.main_vbox.addWidget(self.tool_bar) self.notebook = QTabWidget() self.notebook.setMovable(True) self.main_vbox.addWidget(self.notebook) self.notebook.addTab(self.node_view,"Nodes") self.node_view.show() self.jview=jobs_view() self.jview.load_data(self.myserver.cluster_jobs) self.notebook.addTab(self.jview,"Jobs list") self.setLayout(self.main_vbox) self.myserver.load_update.connect(self.callback_cluster_get_info)
def __init__(self): QWidget.__init__(self) self.setMinimumSize(1000,500) self.html = QWebView() vbox=QVBoxLayout() toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) back = QAction(QIcon_load("go-previous.png"), _("back"), self) back.triggered.connect(self.html.back) toolbar.addAction(back) home = QAction(QIcon_load("user-home.png"), _("home"), self) home.triggered.connect(self.home) toolbar.addAction(home) self.tb_url=QLineEdit() self.tb_url.returnPressed.connect(self.browse) toolbar.addWidget(self.tb_url) vbox.addWidget(toolbar) self.default_url = "http://www.gpvdm.com/welcome.html" self.tb_url.setText(self.default_url) self.browse() vbox.addWidget(self.html) self.setLayout(vbox) return
def generate_toolbar(self): """ Description: There will be a toolbar in the main widget with some buttons, this method will render them. Arguments: None Returns: Nothing """ global IMGDIR, conf self.toolBar = QToolBar(self) refreshAction = QAction(QIcon(IMGDIR + 'refresh.png'), _('refresh'), self) refreshAction.setShortcut('Ctrl+R') refreshAction.triggered.connect(self.refresh_grid) self.toolBar.addAction(refreshAction) self.forgetCredsAction = QAction(QIcon(IMGDIR + 'forget.png'), _('forget_credentials'), self) self.forgetCredsAction.setShortcut('Ctrl+F') self.forgetCredsAction.triggered.connect(self.forget_creds) if not isfile(conf.USERCREDSFILE): self.forgetCredsAction.setDisabled(True) self.toolBar.addAction(self.forgetCredsAction) aboutAction = QAction(QIcon(IMGDIR + 'about.png'), _('about'), self) aboutAction.setShortcut('Ctrl+I') aboutAction.triggered.connect(self.about) self.toolBar.addAction(aboutAction) exitAction = QAction(QIcon(IMGDIR + 'exit.png'), _('exit'), self) exitAction.setShortcut('Ctrl+Q') exitAction.triggered.connect(self.quit_button) self.toolBar.addAction(exitAction) self.grid.addWidget(self.toolBar, 0, 3, Qt.AlignRight)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(720, 480) MainWindow.setIconSize(QtCore.QSize(18, 18)) MainWindow.setDocumentMode(False) self.centralWidget = QtWidgets.QWidget(MainWindow) self.centralWidget.setObjectName("centralWidget") self.btnNewImage = QtWidgets.QPushButton(self.centralWidget) self.btnNewImage.setGeometry(QtCore.QRect(469, 200, 171, 61)) font = QtGui.QFont() font.setPointSize(16) self.btnNewImage.setFont(font) self.btnNewImage.setObjectName("btnNewImage") self.graphicsView = QtWidgets.QGraphicsView(self.centralWidget) self.graphicsView.setGeometry(QtCore.QRect(40, 120, 360, 240)) self.graphicsView.setObjectName("graphicsView") self.label = QtWidgets.QLabel(self.centralWidget) self.label.setGeometry(QtCore.QRect(40, 20, 631, 71)) font = QtGui.QFont() font.setPointSize(32) font.setUnderline(True) self.label.setFont(font) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setWordWrap(False) self.label.setObjectName("label") MainWindow.setCentralWidget(self.centralWidget) self.menuBar = QtWidgets.QMenuBar(MainWindow) self.menuBar.setGeometry(QtCore.QRect(0, 0, 720, 17)) self.menuBar.setObjectName("menuBar") MainWindow.setMenuBar(self.menuBar) self.mainToolBar = QtWidgets.QToolBar(MainWindow) self.mainToolBar.setObjectName("mainToolBar") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar) self.statusBar = QtWidgets.QStatusBar(MainWindow) self.statusBar.setObjectName("statusBar") MainWindow.setStatusBar(self.statusBar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(637, 497) self.centralWidget = QtWidgets.QWidget(MainWindow) self.centralWidget.setObjectName("centralWidget") self.btn_checker_zip = QtWidgets.QPushButton(self.centralWidget) self.btn_checker_zip.setGeometry(QtCore.QRect(220, 20, 201, 51)) self.btn_checker_zip.setObjectName("btn_checker_zip") self.btn_checker_img = QtWidgets.QPushButton(self.centralWidget) self.btn_checker_img.setGeometry(QtCore.QRect(220, 70, 201, 51)) self.btn_checker_img.setObjectName("btn_checker_img") self.result_txt_box = QtWidgets.QTextBrowser(self.centralWidget) self.result_txt_box.setGeometry(QtCore.QRect(40, 180, 551, 241)) self.result_txt_box.setObjectName("result_txt_box") self.btn_checker_resize = QtWidgets.QPushButton(self.centralWidget) self.btn_checker_resize.setGeometry(QtCore.QRect(220, 120, 201, 51)) self.btn_checker_resize.setObjectName("btn_checker_resize") MainWindow.setCentralWidget(self.centralWidget) self.menuBar = QtWidgets.QMenuBar(MainWindow) self.menuBar.setGeometry(QtCore.QRect(0, 0, 637, 22)) self.menuBar.setObjectName("menuBar") self.menuMoloco_Creative_Checker = QtWidgets.QMenu(self.menuBar) self.menuMoloco_Creative_Checker.setObjectName("menuMoloco_Creative_Checker") MainWindow.setMenuBar(self.menuBar) self.mainToolBar = QtWidgets.QToolBar(MainWindow) self.mainToolBar.setObjectName("mainToolBar") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar) self.statusBar = QtWidgets.QStatusBar(MainWindow) self.statusBar.setObjectName("statusBar") MainWindow.setStatusBar(self.statusBar) self.menuBar.addAction(self.menuMoloco_Creative_Checker.menuAction()) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def openDocumentation(self): try: from PyQt5 import QtWebKitWidgets except ImportError: return QtWidgets.QMessageBox.critical( self, 'qt5-webkit não está instalado', 'Por favor instale o pacote Qt5 Webkit para visualizar ' 'a documentação. Caso não possa instalar o pacote, vá' 'para o site: %s' % PYTUGA_DOCUMENTATION_PAGE ) if self._documentation_view is not None: self._documentation_view.show() else: dirname = os.path.dirname(__file__) filename = os.path.join(dirname, 'doc', 'html', 'index.html') view = QtWebKitWidgets.QWebView() view.load(QtCore.QUrl("file://%s" % filename)) page = view.page() window = self._documentation_view = QtWidgets.QWidget() window.setWindowTitle('Documentação') toolbar = QtWidgets.QToolBar() toolbar.addAction(view.pageAction(page.Back)) toolbar.addAction(view.pageAction(page.Forward)) layout = QtWidgets.QVBoxLayout(window) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(toolbar) layout.addWidget(view) window.show()
def setupUi(self, PhotoViewer): PhotoViewer.setObjectName("PhotoViewer") PhotoViewer.resize(473, 414) self.centralwidget = QtWidgets.QWidget(PhotoViewer) self.centralwidget.setObjectName("centralwidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName("verticalLayout") self.view = GraphicsView(self.centralwidget) self.view.setFrameShape(QtWidgets.QFrame.NoFrame) self.view.setFrameShadow(QtWidgets.QFrame.Plain) self.view.setLineWidth(0) self.view.setInteractive(False) self.view.setRenderHints(QtGui.QPainter.Antialiasing|QtGui.QPainter.SmoothPixmapTransform|QtGui.QPainter.TextAntialiasing) self.view.setDragMode(QtWidgets.QGraphicsView.NoDrag) self.view.setTransformationAnchor(QtWidgets.QGraphicsView.AnchorUnderMouse) self.view.setResizeAnchor(QtWidgets.QGraphicsView.AnchorUnderMouse) self.view.setObjectName("view") self.verticalLayout.addWidget(self.view) PhotoViewer.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(PhotoViewer) self.menubar.setGeometry(QtCore.QRect(0, 0, 473, 21)) self.menubar.setObjectName("menubar") PhotoViewer.setMenuBar(self.menubar) self.toolBar = QtWidgets.QToolBar(PhotoViewer) self.toolBar.setObjectName("toolBar") PhotoViewer.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) self.actionBack = QtWidgets.QAction(PhotoViewer) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/images/light/glyphicons-chevron-left.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionBack.setIcon(icon) self.actionBack.setObjectName("actionBack") self.actionForward = QtWidgets.QAction(PhotoViewer) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/images/light/glyphicons-chevron-right.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionForward.setIcon(icon1) self.actionForward.setObjectName("actionForward") self.actionRotateLeft = QtWidgets.QAction(PhotoViewer) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/images/light/glyphicons-rotate-left.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionRotateLeft.setIcon(icon2) self.actionRotateLeft.setObjectName("actionRotateLeft") self.actionRotateRight = QtWidgets.QAction(PhotoViewer) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(":/images/light/glyphicons-rotate-right.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionRotateRight.setIcon(icon3) self.actionRotateRight.setObjectName("actionRotateRight") self.actionRefresh = QtWidgets.QAction(PhotoViewer) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(":/images/light/glyphicons-refresh.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionRefresh.setIcon(icon4) self.actionRefresh.setObjectName("actionRefresh") self.toolBar.addAction(self.actionBack) self.toolBar.addAction(self.actionForward) self.toolBar.addAction(self.actionRotateLeft) self.toolBar.addAction(self.actionRotateRight) self.toolBar.addAction(self.actionRefresh) self.retranslateUi(PhotoViewer) QtCore.QMetaObject.connectSlotsByName(PhotoViewer)
def __init__(self): QWidgetSavePos.__init__(self,"electrical") self.setFixedSize(1000, 600) self.setWindowIcon(QIcon_load("preferences-system")) self.setWindowTitle(_("Electrical parameter editor")+" (https://www.gpvdm.com)") self.main_vbox = QVBoxLayout() toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.undo = QAction(QIcon_load("help"), _("Help"), self) self.undo.setStatusTip(_("Help")) self.undo.triggered.connect(self.callback_help) toolbar.addAction(self.undo) self.main_vbox.addWidget(toolbar) self.notebook = QTabWidget() self.notebook.setMovable(True) self.main_vbox.addWidget(self.notebook) widget=tab_class() widget.init("device.inp",_("Device")) self.notebook.addTab(widget,_("Device")) widget=dos_main() widget.update() self.notebook.addTab(widget,_("Electrical parameters")) if enable_betafeatures()==True: widget=tab_bands() widget.update() self.notebook.addTab(widget,_("Complex DoS")) widget=pl_main() widget.update() self.notebook.addTab(widget,_("Luminescence")) self.setLayout(self.main_vbox) #self.connect("delete-event", self.callback_close_window) self.notebook.currentChanged.connect(self.changed_click) #self.hide()
def __init__(self): QWidget.__init__(self) self.main_vbox=QVBoxLayout() self.save_function=None self.setWindowIcon(QIcon_load("scan")) self.setWindowTitle(_("Dump File Selector")+" (https://www.gpvdm.com)") self.tab = QTreeWidget() self.tab.header().hide() #self.tab.setHeaderItem("Scan items") self.font = QFont() # self.font.setFamily('DejaVu Sans') # self.font.setBold(True) # self.font.setStyleHint(QFont.Monospace) # self.font.setFixedPitch(True) self.font.setPointSize(int(20)) self.tab.setFont(self.font) toolbar=QToolBar() toolbar.setIconSize(QSize(32, 32)) self.refresh = QAction(QIcon_load("view-refresh"), _("Refresh"), self) self.refresh.triggered.connect(self.callback_refresh) toolbar.addAction(self.refresh) self.main_vbox.addWidget(toolbar) self.main_vbox.addWidget(self.tab) self.setLayout(self.main_vbox) #okButton.clicked.connect(self.tree_apply_click) #cancelButton.clicked.connect(self.close) #self.tab.header().close() self.update() self.save() self.tab.itemChanged.connect(self.callback_tree_checked) self.tab.itemClicked.connect(self.tree_callback_clicked) return
def __init__(self,name): QWidgetSavePos.__init__(self,name) self.setMinimumSize(900, 600) self.setWindowIcon(QIcon_load("preferences-system")) self.setWindowTitle(_("Fit configure")+" (https://www.gpvdm.com)") self.main_vbox = QVBoxLayout() toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.undo = QAction(QIcon_load("help"), _("Help"), self) self.undo.setStatusTip(_("Close")) self.undo.triggered.connect(self.callback_help) toolbar.addAction(self.undo) self.main_vbox.addWidget(toolbar) self.notebook = QTabWidget() self.notebook.setMovable(True) self.main_vbox.addWidget(self.notebook) files=[os.path.join(get_sim_path(),"fit.inp")] description=[_("Configure minimizer")] for i in range(0,len(files)): tab=tab_class() tab.init(files[i],description[i]) self.notebook.addTab(tab,description[i]) self.duplicate_window=duplicate() self.notebook.addTab(self.duplicate_window,_("Duplicate window")) self.fit_vars_window=fit_vars() self.notebook.addTab(self.fit_vars_window,_("Fit variable window")) self.constraints_window=constraints() self.notebook.addTab(self.constraints_window,_("Fit constraints")) self.setLayout(self.main_vbox)
def __init__(self): QWidgetSavePos.__init__(self,"contacts") self.setFixedSize(750, 400) self.setWindowIcon(QIcon_load("contact")) self.setWindowTitle(_("Edit contacts")+" (www.gpvdm.com)") self.main_vbox = QVBoxLayout() toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) add = QAction(QIcon_load("list-add"), _("Add contact"), self) add.triggered.connect(self.on_add_clicked) toolbar.addAction(add) remove = QAction(QIcon_load("list-remove"), _("Remove contacts"), self) remove.triggered.connect(self.on_remove_clicked) toolbar.addAction(remove) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.help = QAction(QIcon_load("help"), _("Help"), self) self.help.setStatusTip(_("Close")) self.help.triggered.connect(self.callback_help) toolbar.addAction(self.help) self.main_vbox.addWidget(toolbar) self.tab = QTableWidget() self.tab.resizeColumnsToContents() self.tab.verticalHeader().setVisible(False) self.tab.clear() self.tab.setColumnCount(7) self.tab.setSelectionBehavior(QAbstractItemView.SelectRows) self.load() self.tab.cellChanged.connect(self.tab_changed) self.main_vbox.addWidget(self.tab) self.setLayout(self.main_vbox)
def __init__(self): QWidget.__init__(self) self.setWindowTitle(_("Fit variables duplicate window")+" - https://www.gpvdm.com") self.setWindowIcon(QIcon_load("duplicate")) self.vbox=QVBoxLayout() toolbar=QToolBar() toolbar.setIconSize(QSize(32, 32)) self.tb_save = QAction(QIcon_load("list-add"), _("Add"), self) self.tb_save.triggered.connect(self.callback_add_item) toolbar.addAction(self.tb_save) self.tb_save = QAction(QIcon_load("list-remove"), _("Minus"), self) self.tb_save.triggered.connect(self.callback_delete_item) toolbar.addAction(self.tb_save) self.tb_down= QAction(QIcon_load("go-down"), _("Move down"), self) self.tb_down.triggered.connect(self.on_move_down) toolbar.addAction(self.tb_down) self.tb_up= QAction(QIcon_load("go-up"), _("Move up"), self) self.tb_up.triggered.connect(self.on_move_up) toolbar.addAction(self.tb_up) self.vbox.addWidget(toolbar) self.tab = QTableWidget() self.tab.resizeColumnsToContents() self.tab.verticalHeader().setVisible(False) self.create_model() self.tab.cellChanged.connect(self.tab_changed) self.select_param_window_src=select_param() self.select_param_window_src.init(self.tab) self.select_param_window_src.set_save_function(self.save_combo) self.select_param_window_src.file_name_tab_pos=1 self.select_param_window_src.token_tab_pos=2 self.select_param_window_src.path_tab_pos=3 self.select_param_window_dest=select_param() self.select_param_window_dest.init(self.tab) self.select_param_window_dest.set_save_function(self.save_combo) self.select_param_window_dest.file_name_tab_pos=4 self.select_param_window_dest.token_tab_pos=5 self.select_param_window_dest.path_tab_pos=6 self.vbox.addWidget(self.tab) self.setLayout(self.vbox)
def __init__(self,path): QWidgetSavePos.__init__(self,"spectra_main") self.path=path self.setFixedSize(900, 600) self.setWindowIcon(QIcon_load("spectra_file")) self.setWindowTitle(_("Optical spectrum editor")+" (https://www.gpvdm.com)"+" "+os.path.basename(self.path)) self.main_vbox = QVBoxLayout() toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.help = QAction(QIcon_load("help"), 'Hide', self) self.help.setStatusTip(_("Help")) self.help.triggered.connect(self.callback_help) toolbar.addAction(self.help) self.main_vbox.addWidget(toolbar) self.notebook = QTabWidget() self.notebook.setMovable(True) self.main_vbox.addWidget(self.notebook) files=["mat.inp"] description=[_("Parameters")] eq=equation(self.path,"spectra_eq.inp","spectra_gen.inp","spectra.inp","#spectra_equation_or_data") eq.show_solar_spectra=True eq.set_default_value("3") eq.set_ylabel(_("Intensity")+" (au)") eq.init() self.notebook.addTab(eq,_("Intensity")) for i in range(0,len(files)): tab=tab_class() tab.init(os.path.join(self.path,files[i]),description[i]) self.notebook.addTab(tab,description[i]) self.setLayout(self.main_vbox) self.notebook.currentChanged.connect(self.changed_click)
def __init__(self,index): QWidget.__init__(self) self.index=index self.vbox=QVBoxLayout() toolbar=QToolBar() toolbar.setIconSize(QSize(32, 32)) self.tb_save = QAction(QIcon_load("list-add"), _("Add"), self) self.tb_save.triggered.connect(self.callback_add_item) toolbar.addAction(self.tb_save) self.tb_save = QAction(QIcon_load("list-remove"), _("Minus"), self) self.tb_save.triggered.connect(self.callback_delete_item) toolbar.addAction(self.tb_save) self.tb_down = QAction(QIcon_load("go-down"), _("Move down"), self) self.tb_down.triggered.connect(self.callback_move_down) toolbar.addAction(self.tb_down) self.tb_up = QAction(QIcon_load("go-up"), _("Move up"), self) self.tb_up.triggered.connect(self.callback_move_up) toolbar.addAction(self.tb_up) self.vbox.addWidget(toolbar) self.tab = QTableWidget() self.tab.resizeColumnsToContents() self.tab.verticalHeader().setVisible(False) self.select_param_window=select_param() self.select_param_window.init(self.tab) self.select_param_window.set_save_function(self.save_combo) self.create_model() self.tab.cellChanged.connect(self.tab_changed) self.vbox.addWidget(self.tab) self.setLayout(self.vbox)
def __init__(self): QWidget.__init__(self) edit_boxes=QWidget() vbox=QVBoxLayout() self.lumo=equation_editor("lumo0.inp","LUMO") vbox.addWidget(self.lumo) self.homo=equation_editor("homo0.inp","HOMO") vbox.addWidget(self.homo) edit_boxes.setLayout(vbox) hbox=QHBoxLayout() toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) toolbar.setOrientation(Qt.Vertical) add = QAction(QIcon_load("document-save-as"), _("Save"), self) add.triggered.connect(self.callback_save) toolbar.addAction(add) hbox.addWidget(toolbar) self.LUMO_fig = Figure(figsize=(5,4), dpi=100) self.draw_graph_lumo() self.canvas_lumo = FigureCanvas(self.LUMO_fig) self.canvas_lumo.figure.patch.set_facecolor('white') self.LUMO_fig.tight_layout(pad=0.5) hbox.addWidget(self.canvas_lumo) hbox.addWidget(edit_boxes) self.setLayout(hbox) self.lumo.changed.connect(self.update_graph) self.homo.changed.connect(self.update_graph)
def __init__(self): QWidgetSavePos.__init__(self,"lasers") self.main_vbox = QVBoxLayout() self.setFixedSize(900, 500) self.setWindowTitle(_("Laser configuration window")+" https://www.gpvdm.com") self.setWindowIcon(QIcon_load("lasers")) toolbar=QToolBar() toolbar.setToolButtonStyle( Qt.ToolButtonTextUnderIcon) toolbar.setIconSize(QSize(48, 48)) self.new = QAction(QIcon_load("document-new"), wrap_text(_("New laser"),2), self) self.new.triggered.connect(self.callback_add_page) toolbar.addAction(self.new) self.new = QAction(QIcon_load("edit-delete"), wrap_text(_("Delete laser"),3), self) self.new.triggered.connect(self.callback_delete_page) toolbar.addAction(self.new) self.clone = QAction(QIcon_load("clone.png"), wrap_text(_("Clone laser"),3), self) self.clone.triggered.connect(self.callback_copy_page) toolbar.addAction(self.clone) self.clone = QAction(QIcon_load("rename"), wrap_text(_("Rename laser"),3), self) self.clone.triggered.connect(self.callback_rename_page) toolbar.addAction(self.clone) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.help = QAction(QIcon_load("help"), _("Help"), self) self.help.setStatusTip(_("Close")) self.help.triggered.connect(self.callback_help) toolbar.addAction(self.help) self.main_vbox.addWidget(toolbar) self.notebook = QTabWidget() self.notebook.setMovable(True) self.load_tabs() self.main_vbox.addWidget(self.notebook) self.status_bar=QStatusBar() self.main_vbox.addWidget(self.status_bar) self.setLayout(self.main_vbox)
def init(self): self.setFixedSize(900, 600) self.setWindowIcon(QIcon_load("preferences-system")) self.setWindowTitle(_("Configure")+" (https://www.gpvdm.com)") self.main_vbox = QVBoxLayout() toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.undo = QAction(QIcon_load("help"), _("Help"), self) self.undo.setStatusTip(_("Help")) self.undo.triggered.connect(self.callback_help) toolbar.addAction(self.undo) self.main_vbox.addWidget(toolbar) self.notebook = QTabWidget() self.notebook.setMovable(True) self.main_vbox.addWidget(self.notebook) files=["math.inp","dump.inp","thermal.inp","led.inp","config.inp","server.inp","crypto.inp"] description=[_("Solver configuration"),_("Output files"),_("Thermal"),_("LED"),_("GUI configuration"),_("Server configuration"),_("Cryptography")] for i in range(0,len(files)): file_name=os.path.join(get_sim_path(),files[i]) if inp_isfile(file_name)==True: tab=tab_class() tab.init(file_name,description[i]) self.notebook.addTab(tab,description[i]) if os.path.basename(file_name)=="dump.inp": tab.changed.connect(self.callback_tab_changed) self.detailed_file_select=dump_select() self.notebook.addTab(self.detailed_file_select,_("Detailed dump control")) lang_tab=language_tab_class() self.notebook.addTab(lang_tab,_("Language")) self.setLayout(self.main_vbox) #self.connect("delete-event", self.callback_close_window) #self.hide()
def __init__(self,file_name): QWidgetSavePos.__init__(self,"info") self.setFixedSize(900, 600) self.setWindowIcon(QIcon_load("jv")) self.setWindowTitle(_("Simulation information")+" (www.gpvdm.com)") self.main_vbox = QVBoxLayout() toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.help = QAction(QIcon_load("help"), _("Help"), self) self.help.setStatusTip(_("Close")) self.help.triggered.connect(self.callback_help) toolbar.addAction(self.help) self.main_vbox.addWidget(toolbar) self.notebook = QTabWidget() self.notebook.setMovable(True) self.main_vbox.addWidget(self.notebook) files=[file_name] description=[_("Simulation Information")] for i in range(0,len(files)): tab=tab_class() tab.set_edit(False) tab.init(files[i],description[i]) self.notebook.addTab(tab,description[i]) self.setLayout(self.main_vbox)
def _setup(self, filename): self._viewport = Viewport(self, filename) self._viewport.geometry_changed.connect(self._recenter) self._viewport.playback_stopped.connect(self._playback_stopped) self._isPlaying = True self._hideTimer = None yield from self._viewport.start_playing(filename) toolbar = QtWidgets.QToolBar(self) toolbar.setStyleSheet('QToolBar { background-color : rgba(255,255,255,100) ; color:white; border-color: transparent;} QToolButton{background-color : transparent;}') rewind = toolbar.addAction(QtGui.QIcon('../icons/rewind.svg'), 'Rewind') rewind.triggered.connect(self._rewind) self._playPause = toolbar.addAction(QtGui.QIcon('../icons/pause.svg'), 'Play/pause') self._playPause.triggered.connect(self._toggle_play_state) stop = toolbar.addAction(QtGui.QIcon('../icons/stop.svg'), 'Stop') stop.triggered.connect(self._stop_playback) forward = toolbar.addAction(QtGui.QIcon('../icons/forward.svg'), 'Forward') forward.triggered.connect(self._forward) for cls in [SubtitleSelectionAction, AudioSelectionAction]: action = cls(self._viewport.playbin, self) toolbar.addAction(action) btn = toolbar.widgetForAction(action) btn.setPopupMode(btn.InstantPopup) action.populate() self._seeker = SeekSlider(self._viewport.playbin, self) volume = QtWidgets.QSlider(QtCore.Qt.Horizontal) volume.setMinimum(0) volume.setMaximum(100) volume.setValue(int(100 * self._viewport.playbin.volume)) volume.valueChanged.connect(self.changeVolume) volume.setFixedWidth(100) vlayout = QtWidgets.QVBoxLayout() vlayout.setContentsMargins(3, 3, 3, 3) vlayout.setSpacing(2) hlayout = QtWidgets.QHBoxLayout() hlayout.setContentsMargins(0, 0, 0, 0) hlayout.addWidget(self._seeker.elapsedWidget()) hlayout.addWidget(toolbar, stretch=1) hlayout.addWidget(self._seeker.remainingWidget()) vlayout.addLayout(hlayout) hlayout = QtWidgets.QHBoxLayout() vol = QtWidgets.QLabel('') vol.setPixmap(QtGui.QIcon('../icons/volume.svg').pixmap(24, 24)) hlayout.addWidget(vol) hlayout.addWidget(volume) hlayout.addWidget(self._seeker, stretch=1) vlayout.addLayout(hlayout) self.setLayout(vlayout) self._recenter() self.show() self.startHiding()