class PluginErrorDialog(QDialog): """ Dialog with tabs each tab is a python traceback """ def __init__(self): QDialog.__init__(self) self.setWindowTitle(self.tr("Plugin error report")) self.setModal(True) self.resize(525, 400) vbox = QVBoxLayout(self) label = QLabel(self.tr('Some plugins have errors and were removed')) vbox.addWidget(label) self._tabs = QTabWidget() vbox.addWidget(self._tabs) hbox = QHBoxLayout() btnAccept = QPushButton(self.tr("Accept")) btnAccept.setMaximumWidth(100) hbox.addWidget(btnAccept) vbox.addLayout(hbox) #signals self.connect(btnAccept, SIGNAL("clicked()"), self.close) def add_traceback(self, plugin_name, traceback_msg): traceback_widget = TracebackWidget(traceback_msg) self._tabs.addTab(traceback_widget, plugin_name)
class PluginPreferences(QWidget): """ Plugins section widget in NINJA-IDE Preferences """ def __init__(self): QWidget.__init__(self) self.plugin_manager = plugin_manager.PluginManager() vbox = QVBoxLayout(self) self._tabs = QTabWidget() vbox.addWidget(self._tabs) #load widgets self._load_widgets() def _load_widgets(self): logger.info("Loading plugins preferences widgets") #Collect the preferences widget for each active plugin for plugin in self.plugin_manager.get_active_plugins(): plugin_name = plugin.metadata.get('name') try: preferences_widget = plugin.get_preferences_widget() if preferences_widget: self._tabs.addTab(preferences_widget, plugin_name) except Exception, reason: logger.error("Unable to add the preferences widget (%s): %s", plugin_name, reason) continue
class MainWindow(myDialog): _dbViewWin = None def __init__(self, parent = None, *args, **kwargs): super(MainWindow, self).__init__(parent, *args, **kwargs) self.setWindowTitle("DocAnalyzer") self.myLayout.setContentsMargins(0, 0, 0, 0) self._tabWidget = QTabWidget(self) self._analyzerTab = AnalyzerTab(self._tabWidget) self._viewTab = ViewTab(self._tabWidget) self._viewTab.clicked.connect(self.openDBView) self._tabWidget.addTab(self._viewTab, "View") self._tabWidget.addTab(self._analyzerTab, "Analyze") self.myLayout.addRow(self._tabWidget) # self.setFixedSize(400, 300) def openDBView(self, dbName): if not dbName: messageBox(QMessageBox.Critical, "Fehler", "Der Name darf nicht leer sein!", self, QMessageBox.Ok) return None # if self._dbViewWin == None: self._dbViewWin = ViewWindow(self, "%s.sqlite" %str(dbName)) self._dbViewWin.show()
class PluginPreferences(QWidget): """ Plugins section widget in NINJA-IDE Preferences """ def __init__(self): QWidget.__init__(self) self.plugin_manager = plugin_manager.PluginManager() vbox = QVBoxLayout(self) self._tabs = QTabWidget() vbox.addWidget(self._tabs) # load widgets self._load_widgets() def _load_widgets(self): logger.info("Loading plugins preferences widgets") # Collect the preferences widget for each active plugin for plugin in self.plugin_manager.get_active_plugins(): plugin_name = plugin.metadata.get("name") try: preferences_widget = plugin.get_preferences_widget() if preferences_widget: self._tabs.addTab(preferences_widget, plugin_name) except Exception, reason: logger.error("Unable to add the preferences widget (%s): %s", plugin_name, reason) continue
class AcercaDe(QDialog): def __init__(self, parent): QDialog.__init__(self, parent, Qt.WindowMinMaxButtonsHint) self.setWindowTitle(self.tr("Acerca de EDIS")) box = QVBoxLayout(self) label_logo = QLabel() label_logo.setPixmap(QPixmap(paths.ICONOS['icon'])) label_titulo = QLabel(self.tr("<h1>EDIS</h1>\n<i>Simple Integrated " "Development Environment</i>")) box_logo = QHBoxLayout() self.tabs = QTabWidget() self.tabs.addTab(AboutTab(), self.tr("Acerca de")) self.tabs.addTab(ReportarBugTab(), self.tr("Reportar bug")) box_logo.addWidget(label_logo) box_logo.addWidget(label_titulo) box.addLayout(box_logo) box.addWidget(self.tabs) box_boton = QHBoxLayout() box_boton.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) boton_ok = QPushButton(self.tr("Ok")) box_boton.addWidget(boton_ok) box.addLayout(box_boton) boton_ok.clicked.connect(self.close)
class PluginErrorDialog(QDialog): """ Dialog with tabs each tab is a python traceback """ def __init__(self): QDialog.__init__(self) self.setWindowTitle(self.tr("Plugin error report")) self.resize(525, 400) vbox = QVBoxLayout(self) label = QLabel(self.tr("Some plugins have errors and were removed")) vbox.addWidget(label) self._tabs = QTabWidget() vbox.addWidget(self._tabs) hbox = QHBoxLayout() btnAccept = QPushButton(self.tr("Accept")) btnAccept.setMaximumWidth(100) hbox.addWidget(btnAccept) vbox.addLayout(hbox) # signals self.connect(btnAccept, SIGNAL("clicked()"), self.close) def add_traceback(self, plugin_name, traceback_msg): traceback_widget = TracebackWidget(traceback_msg) self._tabs.addTab(traceback_widget, plugin_name)
def g_display(self): QWidget.__init__(self) self.evtWidget = None self.evtxWidget = None layout = QHBoxLayout(self) layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) widget = QTabWidget() layout.addWidget(widget) processus_manager = ModuleProcessusManager() evtx = processus_manager.get('evtx') evt = processus_manager.get('evt') try: self.evtxWidgets = evtx.getall('/') if self.evtxWidgets: if self.evtxWidgets.list_widget.count(): widget.addTab(self.evtxWidgets, "Events logs (.evtx)") except Exception as e: pass try: self.evtWidgets = evt.getAllEvtFiles('/') if self.evtWidgets.evtFileListWidget.count(): widget.addTab(self.evtWidgets, "Events logs (.evt)") except Exception as e: pass
class PluginErrorDialog(QDialog): """ Dialog with tabs each tab is a python traceback """ def __init__(self): QDialog.__init__(self) self.setWindowTitle(translations.TR_PLUGIN_ERROR_REPORT) self.resize(600, 400) vbox = QVBoxLayout(self) label = QLabel(translations.TR_SOME_PLUGINS_REMOVED) vbox.addWidget(label) self._tabs = QTabWidget() vbox.addWidget(self._tabs) hbox = QHBoxLayout() btnAccept = QPushButton(translations.TR_ACCEPT) btnAccept.setMaximumWidth(100) hbox.addWidget(btnAccept) vbox.addLayout(hbox) # signals self.connect(btnAccept, SIGNAL("clicked()"), self.close) def add_traceback(self, plugin_name, traceback_msg): """Add a Traceback to the widget on a new tab""" traceback_widget = TracebackWidget(traceback_msg) self._tabs.addTab(traceback_widget, plugin_name)
class PluginErrorDialog(QDialog): """ Dialog with tabs each tab is a python traceback """ def __init__(self): QDialog.__init__(self) self.setWindowTitle(translations.TR_PLUGIN_ERROR_REPORT) self.resize(600, 400) vbox = QVBoxLayout(self) label = QLabel(translations.TR_SOME_PLUGINS_REMOVED) vbox.addWidget(label) self._tabs = QTabWidget() vbox.addWidget(self._tabs) hbox = QHBoxLayout() btnAccept = QPushButton(translations.TR_ACCEPT) btnAccept.setMaximumWidth(100) hbox.addWidget(btnAccept) vbox.addLayout(hbox) #signals self.connect(btnAccept, SIGNAL("clicked()"), self.close) def add_traceback(self, plugin_name, traceback_msg): """Add a Traceback to the widget on a new tab""" traceback_widget = TracebackWidget(traceback_msg) self._tabs.addTab(traceback_widget, plugin_name)
class CarverGui(QWidget, Script): def __init__(self): Script.__init__(self, "carver-gui") def start(self, args): self.args = args self.node = args["file"].value() self.name += " <" + self.node.name() + ">" self.filesize = self.node.size() def status(self): return 0 def g_display(self): #define layout QWidget.__init__(self) self.baseLayout = QHBoxLayout() self.setLayout(self.baseLayout) self.tabwidgets = QTabWidget() #define all area self.user = UserPatterns(self.args["file"]) self.pp = PredefinedPatterns(self.args["file"]) self.tabwidgets.addTab(self.pp, "Predefined Patterns") self.tabwidgets.addTab(self.user, "User defined") #add widget and hide progress bars self.baseLayout.addWidget(self.tabwidgets) def updateWidget(self): pass def setStateInfo(self, sinfo): self.stateinfo = str(sinfo)
def _init_gui_tab_and_groupbox_widgets(self): #top area for main stuff group_box_main_config = QGroupBox("Configuration") main_config_layout = QFormLayout() widget_delimiter = self._init_gui_delimiter_entries() tab_widget = QTabWidget() tab_widget.addTab(widget_delimiter, "delimiter") tab_widget.addTab(self.color_choosing_widget, "colors") #widget for bottom = save button save_widget = QWidget() layout_save_widget = QFormLayout() save_button = QPushButton("save", self) QObject.connect(save_button, SIGNAL('clicked()'), self._save_config) layout_save_widget.addWidget(save_button) save_widget.setLayout(layout_save_widget) main_config_layout.addRow(self.checkbox_start_with_last_opened_file) group_box_main_config.setLayout(main_config_layout) tab_widget_layout = QVBoxLayout() tab_widget_layout.addWidget(group_box_main_config) tab_widget_layout.addWidget(tab_widget) tab_widget_layout.addWidget(save_widget) return tab_widget_layout
def _create_central_widget(self): tabs = QTabWidget() splitter = QSplitter() self.treeview = QTreeView() self.treeview.header().hide() self.treeview.resize(500, 0) splitter.addWidget(self.treeview) self.editwidget = QWidget() self.editwidget.setLayout(QVBoxLayout()) self.editwidget.resize(300, 300) self.editwidget.setMinimumSize(300, 100) splitter.addWidget(self.editwidget) self.glwidget = GLWidget() splitter.addWidget(self.glwidget) splitter.setStretchFactor(0, 2) splitter.setStretchFactor(1, 2) splitter.setStretchFactor(2, 4) tabs.addTab(splitter, "Mesh") tabs.addTab(self._create_run(), "Run") self.setCentralWidget(tabs)
def initUI(self): mainWidget = QWidget() mainWidget.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) self.setCentralWidget(mainWidget) top = QVBoxLayout(mainWidget) tabs = QTabWidget(self) top.addWidget(tabs) logTab = QWidget() debugLogTabLayout = QVBoxLayout(logTab) debugLogTabLayout.setAlignment(Qt.AlignLeft | Qt.AlignTop) tabs.addTab(logTab, "Log") self.debugLogWidget = DebugLogWidget(self) self.debugLogWidget.addToWidget(debugLogTabLayout) self.testLogButton = QPushButton("Test Log", self) self.testLogButton.clicked.connect(self._testLog) top.addWidget(self.testLogButton) self.setGeometry(0, 0, 800, 400) self.setWindowTitle('Log Test') self.show()
class GertMainWindow(QMainWindow): """An application (window widget) with a list of "tasks" on the left side and a panel on the right side""" def __init__(self): """Constructor""" QMainWindow.__init__(self) self.resize(900, 700) self.setWindowTitle('gERT') self.tabs = QTabWidget() self.setCentralWidget(self.tabs) self.help_dock = HelpDock.getInstance() self.addDockWidget(Qt.RightDockWidgetArea, self.help_dock) self.__createMenu() self.save_function = None self.__fetchSettings() def setSaveFunction(self, save_function): """Set the function to be called when the save menu choice is selected.""" self.save_function = save_function def addTab(self, name, tab_widget): self.tabs.addTab(tab_widget, name) def __save(self): if not self.save_function is None: self.save_function() def __createMenu(self): file_menu = self.menuBar().addMenu("&File") file_menu.addAction("Save Config File", self.__save) file_menu.addAction("Close", self.__quit) view_menu = self.menuBar().addMenu("&View") view_menu.addAction(self.help_dock.toggleViewAction()) def __quit(self): self.__saveSettings() qApp.quit() def __saveSettings(self): settings = QSettings("Statoil", "ErtGui") settings.setValue("geometry", self.saveGeometry()) settings.setValue("windowState", self.saveState()) def closeEvent(self, event): #Use QT settings saving mechanism #settings stored in ~/.config/Statoil/ErtGui.conf self.__saveSettings() QMainWindow.closeEvent(self, event) def __fetchSettings(self): settings = QSettings("Statoil", "ErtGui") self.restoreGeometry(settings.value("geometry").toByteArray()) self.restoreState(settings.value("windowState").toByteArray())
class PdtCheckResultDlg(QDialog): def __init__(self, parent, parameterList): QDialog.__init__(self, parent) self.setObjectName("PdtCheckResultDlg") self.setWindowTitle("PDT Check") self.resize(350, 400) self.verticalLayout = QVBoxLayout(self) self.verticalLayout.setObjectName("verticalLayout") self.tabWidgetPDT = QTabWidget(self) self.tabWidgetPDT.setObjectName("tabWidgetPDT") if len(parameterList) < 1: return for parameters in parameterList: self.tab = tabControl(self) isaValue = parameters[1] altitude = parameters[2] iasValue = parameters[3] speed_1 = Speed.smethod_0(Speed(iasValue, SpeedUnits.KTS), isaValue, altitude) + Speed(25) straitSegment = speed_1.KilometresPerHour * 1000 / 3600 * 9 pdtResultStr = "" K = round( 171233 * math.pow(288 + isaValue - 0.00198 * altitude.Feet, 0.5) / (math.pow(288 - 0.00198 * altitude.Feet, 2.628)), 4) pdtResultStr = "1. K = \t" + str(K) + "\n" V = K * iasValue pdtResultStr += "2. V = \t" + str(V) + "kts\n" h = altitude.Metres pdtResultStr += "3. h = \t" + str(h) + "m\n" # h = altitude.Feet / 1000 pdtResultStr += "4. w = \t" + "46km/h\n" num = 2313.03083707 / (3.14159265358979 * speed_1.KilometresPerHour) if (num > 3): num = 3 r = speed_1.KilometresPerHour / (62.8318530717959 * num) * 1000 pdtResultStr += "5. r = \t" + str(r / 1000) + "km\n" R = 2 * r + straitSegment pdtResultStr += "6. R = \t" + str(R / 1000) + "km\n" # resultStr = MathHelper.pdtCheckResultToString(parameters[1], parameters[2], parameters[3], parameters[4]) self.tab.plainTextEdit.setPlainText(pdtResultStr) try: self.tabWidgetPDT.addTab(self.tab, parameters[0]) except: self.tabWidgetPDT.addTab(self.tab, "") # self.tabWidgetPDT.addTab(self.tab, "A") self.verticalLayout.addWidget(self.tabWidgetPDT)
class WExportStatistics(QtHelper.EnhancedQDialog, Logger.ClassLogger): """ Export statistics dialog """ def __init__(self, parent, dataXml): """ Constructs export statistics dialog @param parent: @type parent: """ super(WExportStatistics, self).__init__(parent) self.__dataXml = dataXml self.createWidgets() self.createConnections() def createWidgets(self): """ QtWidgets creation """ self.setWindowFlags(self.windowFlags() | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setStyleSheet("""QDialogButtonBox { dialogbuttonbox-buttons-have-icons: 1; dialog-ok-icon: url(:/ok.png); dialog-cancel-icon: url(:/ko.png); }""") self.buttonBox.setStandardButtons(QDialogButtonBox.Ok) self.xmlWidget = RawView(self, self.__dataXml, toCsv=False, toHtml=False, toXml=True, toPrinter=True, toTxt=False, toPdf=True) layout = QVBoxLayout() self.mainTab = QTabWidget() self.mainTab.addTab(self.xmlWidget, 'Xml') layout.addWidget(self.mainTab) layout.addWidget(self.buttonBox) self.setWindowTitle("Export Test Statistics") self.setLayout(layout) def createConnections(self): """ Qt connections """ self.buttonBox.accepted.connect(self.accept)
def setup_page(self): tabs = QTabWidget() names = self.get_option("names") names.pop(names.index(CUSTOM_COLOR_SCHEME_NAME)) names.insert(0, CUSTOM_COLOR_SCHEME_NAME) fieldnames = { "background": _("Background:"), "currentline": _("Current line:"), "occurence": _("Occurence:"), "ctrlclick": _("Link:"), "sideareas": _("Side areas:"), "matched_p": _("Matched parentheses:"), "unmatched_p": _("Unmatched parentheses:"), "normal": _("Normal text:"), "keyword": _("Keyword:"), "builtin": _("Builtin:"), "definition": _("Definition:"), "comment": _("Comment:"), "string": _("String:"), "number": _("Number:"), "instance": _("Instance:"), } from SMlib.widgets.sourcecode import syntaxhighlighters assert all([key in fieldnames for key in syntaxhighlighters.COLOR_SCHEME_KEYS]) for tabname in names: cs_group = QGroupBox(_("Color scheme")) cs_layout = QGridLayout() for row, key in enumerate(syntaxhighlighters.COLOR_SCHEME_KEYS): option = "%s/%s" % (tabname, key) value = self.get_option(option) name = fieldnames[key] if isinstance(value, basestring): label, clayout = self.create_coloredit(name, option, without_layout=True) label.setAlignment(Qt.AlignRight|Qt.AlignVCenter) cs_layout.addWidget(label, row+1, 0) cs_layout.addLayout(clayout, row+1, 1) else: label, clayout, cb_bold, cb_italic = self.create_scedit( name, option, without_layout=True) label.setAlignment(Qt.AlignRight|Qt.AlignVCenter) cs_layout.addWidget(label, row+1, 0) cs_layout.addLayout(clayout, row+1, 1) cs_layout.addWidget(cb_bold, row+1, 2) cs_layout.addWidget(cb_italic, row+1, 3) cs_group.setLayout(cs_layout) if tabname in sh.COLOR_SCHEME_NAMES: def_btn = self.create_button(_("Reset to default values"), lambda: self.reset_to_default(tabname)) tabs.addTab(self.create_tab(cs_group, def_btn), tabname) else: tabs.addTab(self.create_tab(cs_group), tabname) vlayout = QVBoxLayout() vlayout.addWidget(tabs) self.setLayout(vlayout)
class AppForm(QDialog): def __init__(self, parent=None): QDialog.__init__(self, parent) self.setWindowTitle('manualGUI') self.resize(600, 400) self.create_main_frame() print('Start!!!\r\n') def closeEvent(self, event): print('Stop!!!\r\n') def on_chkLED(self): if self.chkLED.checkState(): print('On\r\n') else: print('On\r\n') def timer_tick(self): print('Tick!!!\r\n') def create_main_frame(self): self.timer = QTimer() self.timer.timeout.connect(self.timer_tick) self.horizontalLayout = QHBoxLayout(self) self.tabs = QTabWidget(self) self.tab1 = QWidget() self.tabs.addTab(self.tab1, "t1") self.tab2 = QWidget() self.tabs.addTab(self.tab2, "t2") self.horizontalLayout.addWidget(self.tabs) self.chkLED = QCheckBox("LED", self.tab1) self.chkLED.setChecked(False) self.connect(self.chkLED, SIGNAL('stateChanged(int)'), self.on_chkLED) self.labButton = QLabel("Button OFF", self.tab1) self.memo = QTextBrowser(self.tab1) vbox = QVBoxLayout() vbox.addWidget(self.chkLED) vbox.addWidget(self.labButton) vbox.addWidget(self.memo) self.tab1.setLayout(vbox) self.fig = Figure() self.canvas = FigureCanvas(self.fig) self.canvas.setParent(self) self.axes = self.fig.add_subplot(111) hbox = QVBoxLayout() hbox.addWidget(self.canvas) self.tab2.setLayout(hbox) self.tabs.setCurrentIndex(1)
class lovellGui(QMainWindow): def __init__(self, run_data_dir, parent=None): QMainWindow.__init__(self, parent) self.top_tab = QTabWidget(self) self.setCentralWidget(self.top_tab) self.top_tab.addTab(velo_view(run_data_dir, self), 'VELO view') self.top_tab.addTab(run_view(run_data_dir, self), 'Run view') self.top_tab.addTab(QWidget(self), 'Sensor view') self.top_tab.addTab(QWidget(self), 'TELL1') self.top_tab.addTab(QWidget(self), 'Special analyses') self.top_tab.setCurrentIndex(1)
class PreferencesWindow (QDialog): def __init__(self, parent): QDialog.__init__(self, parent, Qt.Dialog) self.setWindowTitle('NINJA - Preferences') self.setMaximumSize(QSize(0,0)) self.setModal(True) main_box = QVBoxLayout(self) self.GeneralTab = TabGeneral() self.EditTab = TabEdit() self.ColorsTab = TabColors() self.InterfaceTab = TabInterface(parent) self.CSSTab = TabCSS() self.TemplatesTab = TabTemplates() self.Tabs = QTabWidget() self.Tabs.setTabPosition(2) self.Tabs.setMovable(False) #Tabs self.Tabs.addTab(self.GeneralTab, "General") #self.Tabs.addTab(self.EditTab, "Edit") #self.Tabs.addTab(self.ColorsTab, "Colors") self.Tabs.addTab(self.InterfaceTab, "Interface") #self.Tabs.addTab(self.CSSTab, "CSS") #self.Tabs.addTab(self.TemplatesTab, "Templates") #Footer Buttons self.btn_save = QPushButton('&Save') self.btn_cancel = QPushButton('&Cancel') h_footer = QHBoxLayout() h_footer.addWidget(self.btn_save) h_footer.addWidget(self.btn_cancel) g_footer = QGridLayout() g_footer.addLayout(h_footer, 0, 0, Qt.AlignRight) main_box.addWidget(self.Tabs) main_box.addLayout(g_footer) def save_changes(): self.GeneralTab.save_state() self.InterfaceTab.save_state(parent) self.close() def cancel_changes(): parent.reload_panels_position() self.close() #SIGNAL self.connect(self.btn_cancel, SIGNAL("clicked()"), cancel_changes) self.connect(self.btn_save, SIGNAL("clicked()"), save_changes)
def create_widget(self, parent): from stat_visualize.diagram import statTimelineTab, statSwarmTab from PyQt4.QtGui import QTabWidget,QLabel from PyQt4.QtCore import Qt connPlugin, plugin_type = get_db_connection(self.logger, self.options["db_connection"]) w = QTabWidget(parent) w.addTab(statTimelineTab(parent, connPlugin, self.logger), "Timeline") w.addTab(statSwarmTab(parent, connPlugin, self.logger), "Swarm") return w
class PreferencesWindow(QDialog): def __init__(self, parent): QDialog.__init__(self, parent, Qt.Dialog) self.setWindowTitle('NINJA - Preferences') self.setMaximumSize(QSize(0, 0)) self.setModal(True) main_box = QVBoxLayout(self) self.GeneralTab = TabGeneral() self.EditTab = TabEdit() self.ColorsTab = TabColors() self.InterfaceTab = TabInterface(parent) self.CSSTab = TabCSS() self.TemplatesTab = TabTemplates() self.Tabs = QTabWidget() self.Tabs.setTabPosition(2) self.Tabs.setMovable(False) #Tabs self.Tabs.addTab(self.GeneralTab, "General") #self.Tabs.addTab(self.EditTab, "Edit") #self.Tabs.addTab(self.ColorsTab, "Colors") self.Tabs.addTab(self.InterfaceTab, "Interface") #self.Tabs.addTab(self.CSSTab, "CSS") #self.Tabs.addTab(self.TemplatesTab, "Templates") #Footer Buttons self.btn_save = QPushButton('&Save') self.btn_cancel = QPushButton('&Cancel') h_footer = QHBoxLayout() h_footer.addWidget(self.btn_save) h_footer.addWidget(self.btn_cancel) g_footer = QGridLayout() g_footer.addLayout(h_footer, 0, 0, Qt.AlignRight) main_box.addWidget(self.Tabs) main_box.addLayout(g_footer) def save_changes(): self.GeneralTab.save_state() self.InterfaceTab.save_state(parent) self.close() def cancel_changes(): parent.reload_panels_position() self.close() #SIGNAL self.connect(self.btn_cancel, SIGNAL("clicked()"), cancel_changes) self.connect(self.btn_save, SIGNAL("clicked()"), save_changes)
def createElectricalSettingsTab(self): electricalSettingsTab = QTabWidget() electricalSettingsTab.addTab( self.createElectricalSimulationSettingsTab(), "Simulation") electricalSettingsTab.addTab( self.createElectricalSimulationVisualizationTab(), "Visualization") electricalSettingsTab.setTabPosition(QTabWidget.East) electricalSettingsTab.setTabShape(QTabWidget.Triangular) electricalSettingsTab.setDocumentMode(True) electricalSettingsTab.setUsesScrollButtons(True) electricalSettingsTab.setFocusPolicy(PyQt4.QtCore.Qt.NoFocus) return electricalSettingsTab
def setup_gui(self): dialog_layout = QVBoxLayout() main_widget = QTabWidget() main_widget.addTab(self.setup_simulation_tab(), "Simulation") main_widget.addTab(self.setup_help_tab(), "Help") dialog_layout.addWidget(main_widget) self.setLayout(dialog_layout) self.adjustSize() self.setWindowTitle('simSurf - Geosurface simulation')
class PageDialog(QDialog): okClicked = pyqtSignal() cancelClicked = pyqtSignal() settingsCancelled = pyqtSignal() def __init__(self, parent = None): QDialog.__init__(self, parent) self.prnt = parent self.tr = Translator() self.setWindowTitle(self.tr._translate('M@il Checker : Settings')) self.tabWidget = QTabWidget(self) self.tabWidget.setTabPosition(QTabWidget.North) self.layout = QVBoxLayout() self.buttonLayout = QHBoxLayout() self.ok = QPushButton(QIcon.fromTheme("dialog-ok"), "", self) self.cancel = QPushButton(QIcon.fromTheme("dialog-cancel"), "", self) self.buttonLayout.addWidget(self.ok) self.buttonLayout.addWidget(self.cancel) self.layout.addWidget(self.tabWidget) self.layout.addItem(self.buttonLayout) self.setLayout(self.layout) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.setMinimumWidth(100) self.ok.clicked.connect(self.accepted) self.cancel.clicked.connect(self.rejected) QTimer.singleShot(100, self._restoreGeometry) def _restoreGeometry(self): self.restoreGeometry(self.prnt.Settings.value('SettingsGeometry').toByteArray()) def addPage(self, wdg, wdgName): self.tabWidget.addTab(wdg, wdgName) def accepted(self): self.okClicked.emit() def rejected(self): self.settingsCancelled.emit() self.cancelClicked.emit() def closeEvent(self, ev): ev.ignore() self.rejected() def _close(self): self.prnt.Settings.setValue('SettingsGeometry', self.saveGeometry()) if not self.prnt.isVisible() : self.prnt.show() self.prnt.autoHide(3) if self.prnt.isMinimized() : self.prnt.showNormal() self.done(0)
def tabbox(*args): """ adds a box with tab params: (widget, title) title is the string """ tab_widget = QTabWidget() tab_widget.setMovable(True) # tab_widget.setAutoFillBackground(True) # tab_widget.setTabShape(QTabWidget.Triangular) # tab_widget.setTabPosition(QTabWidget.West) for box, btitle in args: pane = TabPane() pane.addBox(box) tab_widget.addTab(pane, btitle) return tab_widget
def __init__(self, parent=None, plotView=None, width=100): QtGui.QFrame.__init__(self, parent) self.setFrameShape(QtGui.QFrame.StyledPanel) self.setFrameShadow(QtGui.QFrame.Plain) self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.setMinimumWidth(width) self.setMaximumWidth(width) self.plotView = plotView layout = QtGui.QVBoxLayout() plot_configs = self.plotView.getPlotConfigList() tabbed_panel = QTabWidget() tabbed_panel.setTabPosition(QTabWidget.West) for plot_config in plot_configs: config_panel = PlotConfigPanel(plot_config) tabbed_panel.addTab(config_panel, plot_config.name) #self.connect(config_panel, SIGNAL('plotConfigChanged()'), self.plotView.drawPlot) layout.addWidget(tabbed_panel) tabbed_panel = QTabWidget() #tabbed_panel.setTabPosition(QTabWidget.West) tabbed_panel.addTab(self.createMemberSelectionPanel(), "Members") tabbed_panel.addTab(self.createPlotRangePanel(), "Plot") tabbed_panel.addTab(self.createButtonLayout(), "Production") tabbed_panel.setMaximumHeight(250) layout.addWidget(tabbed_panel) self.setLayout(layout)
def initUI(self): mainWidget = QWidget() mainWidget.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) self.setCentralWidget(mainWidget) top = QVBoxLayout(mainWidget) tabs = QTabWidget(self) top.addWidget(tabs) gpsTab = QWidget() gpsTabLayout = QHBoxLayout(gpsTab) gpsTabLayout.setAlignment(Qt.AlignLeft | Qt.AlignTop) tabs.addTab(gpsTab, "GSM") self.osmWidget = GPSMonitor(self) self.osmWidget.loadConfig(self.config) self.osmWidget.addToWidget(gpsTabLayout) self.zoom = 9 self.startLat = 47.8 self.startLon = 13.0 self.testGPSButton = QPushButton("Test GPS", self) self.testGPSButton.clicked.connect(self._testGPS) top.addWidget(self.testGPSButton) connectBox = QHBoxLayout() top.addLayout(connectBox) self.connectGPSButton = QCheckBox('GPS Connect', self) self.connectGPSButton.clicked.connect(self._connectGPS) self.connectGPSButton.setChecked(self.connectGPSEnable) connectBox.addWidget(self.connectGPSButton) self.setGeometry(0, 0, 800, 400) self.setWindowTitle('GPS Test') self.updateGPSThread = GPSUpateWorkerGPSD(self) self.connect(self.updateGPSThread, SIGNAL("updateStatus(QString)"), self.updateStatusLabel) self.connect(self.updateGPSThread, SIGNAL("connectGPSFailed()"), self.connectGPSFailed) self.connect(self.updateGPSThread, SIGNAL("updateGPSDisplay(PyQt_PyObject)"), self.updateGPSDisplay) self._connectGPS() self.show()
def __init__(self): super(PreferencesDialog, self).__init__() vbox = QVBoxLayout(self) tabbed = QTabWidget() self.gp = GeneralPreferences() tabbed.addTab(self.gp, u"General") self.cp = ConectatePreferences() tabbed.addTab(self.cp, u"Conectate") vbox.addWidget(tabbed) bbox = QDialogButtonBox(QDialogButtonBox.Ok) bbox.accepted.connect(self.accept) bbox.accepted.connect(self._save) vbox.addWidget(bbox)
def setup_gui( self ): dialog_layout = QVBoxLayout() main_widget = QTabWidget() main_widget.addTab( self.setup_simulation_tab(), "Simulation" ) main_widget.addTab( self.setup_help_tab(), "Help" ) dialog_layout.addWidget(main_widget) self.setLayout( dialog_layout ) self.adjustSize() self.setWindowTitle( 'simSurf - Geosurface simulation' )
def createElectricalSettingsTab(self): electricalSettingsTab = QTabWidget() electricalSettingsTab.addTab( self.createElectricalSimulationSettingsTab() , "Simulation" ) electricalSettingsTab.addTab( self.createElectricalSimulationVisualizationTab() , "Visualization" ) electricalSettingsTab.setTabPosition(QTabWidget.East) electricalSettingsTab.setTabShape(QTabWidget.Triangular) electricalSettingsTab.setDocumentMode(True) electricalSettingsTab.setUsesScrollButtons(True) electricalSettingsTab.setFocusPolicy(PyQt4.QtCore.Qt.NoFocus) return electricalSettingsTab
class BuilderGui(QMainWindow): def __init__(self, confFile, parent=None): QMainWindow.__init__(self, parent) self.setWindowTitle('Coriolis/Chams Builder') self._tabWidget = QTabWidget() self._configureWidget = ConfigureWidget(confFile) self._optionsWidget = OptionsWidget(self._configureWidget.conf) self._compileWidget = CompileWidget() self._aboutWidget = AboutWidget() self._tabWidget.addTab(self._optionsWidget, 'Options') self._tabWidget.addTab(self._compileWidget, 'Compile') self._tabWidget.addTab(self._configureWidget, 'Configure') self.setCentralWidget(self._tabWidget) self._compileWidget.conf = self._configureWidget self._compileWidget.options = self._optionsWidget self._exitAction = QAction('&Exit', self) self._exitAction.setStatusTip('Exit CCB (settings are saved)') self._exitAction.setShortcut(QKeySequence('CTRL+Q')) self._exitAction.triggered.connect(QApplication.closeAllWindows) self._saveAction = QAction('&Save Settings', self) self._saveAction.setStatusTip('Save Settings') self._saveAction.setShortcut(QKeySequence('CTRL+S')) self._saveAction.triggered.connect(self._configureWidget.saveSettings) self._saveAction.triggered.connect(self._optionsWidget.saveSettings) self._saveAction.triggered.connect(self._compileWidget.saveSettings) self._aboutAction = QAction('&About', self) self._aboutAction.setStatusTip( 'A Word About Who\'s Responsible for This Thing') self._aboutAction.setShortcut(QKeySequence('CTRL+A')) self._aboutAction.triggered.connect(self._aboutWidget.show) fileMenu = self.menuBar().addMenu('File') fileMenu.addAction(self._exitAction) fileMenu.addAction(self._saveAction) fileMenu.addAction(self._aboutAction) return def closeEvent(self, event): self._configureWidget.saveSettings() self._optionsWidget.saveSettings() self._compileWidget.saveSettings() event.accept() return
class EditorTab(QWidget): def __init__(self, main): QWidget.__init__(self) vbox = QVBoxLayout(self) self.tabs = QTabWidget() self.editorGeneral = EditorGeneral(main) self.editorConfiguration = EditorConfiguration(main) self.tabs.addTab(self.editorGeneral, 'General') self.tabs.addTab(self.editorConfiguration, 'Configuration') vbox.addWidget(self.tabs) def save(self): for i in range(self.tabs.count()): self.tabs.widget(i).save()
class SkinsManagerWidget(QDialog): def __init__(self, parent): QDialog.__init__(self, parent, Qt.Dialog) self._parent = parent self.setWindowTitle('Skins and Schemes Manager') self.resize(700, 500) vbox = QVBoxLayout(self) self._tabs = QTabWidget() vbox.addWidget(self._tabs) self.overlay = Overlay(self) self.overlay.show() self._skins = [] self._schemes = [] self.loading = True self.thread = ThreadLoadSkins(self) self.connect(self.thread, SIGNAL("finished()"), self.load_skins_data) self.thread.start() def load_skins_data(self): if self.loading: self.skinsWidget = SkinsWidget(self, self._skins) self.schemeWidget = SchemeWidget(self, self._schemes) self._tabs.addTab(self.skinsWidget, 'Skins') self._tabs.addTab(self.schemeWidget, 'Schemes') self.loading = False self.overlay.hide() def download_skin(self, skin): self.overlay.show() self.thread.skin = skin self.thread.runnable = self.thread.download_skins_thread self.thread.start() def download_scheme(self, scheme): self.overlay.show() self.thread.skin = scheme self.thread.runnable = self.thread.download_scheme_thread self.thread.start() def resizeEvent(self, event): self.overlay.resize(event.size()) event.accept()
class TabEditor(QWidget): """ Tab Editor """ def __init__(self): super(TabEditor, self).__init__() vbox = QVBoxLayout(self) vbox.setContentsMargins(0, 0, 0, 0) self.setObjectName("tabs") self.tabs = QTabWidget() self.tabs.setTabPosition(3) self.configEditor = CaracteristicasEditor() self.tabs.addTab(self.configEditor, self.trUtf8("Características")) vbox.addWidget(self.tabs) def guardar(self): for i in range(self.tabs.count()): self.tabs.widget(i).guardar()
class velo_view(QWidget): # Class to set up VELO view tab with DQ trending def __init__(self, run_data_dir, parent=None): QTabWidget.__init__(self, parent) self.run_data_dir = run_data_dir self.grid_layout = QGridLayout() lFuncs.setPadding(self.grid_layout) self.setLayout(self.grid_layout) self.pages = [] self.setup_tabs() def setup_tabs(self): self.top_tab = QTabWidget(self) veloview_config = lInterfaces.veloview_config() self.tab_options = lTabOptions.lTabOptions(self, self.run_data_dir) nTabs = len(veloview_config) i = 1 for key, val in veloview_config.iteritems(): msg = 'Preparing tab (' + str(i) + '/' + str( nTabs) + '): ' + val['title'] print msg page = lTab.lTab(val, self) if val['title'] == 'Trends': page.modifyPageForTrending(self.run_data_dir, False) if val['title'] == 'Detailed trends': page.modifyPageForTrending(self.run_data_dir, True) self.top_tab.addTab(page, val['title']) self.pages.append(page) i += 1 self.grid_layout.addWidget(self.top_tab, 0, 0) self.top_tab.currentChanged.connect(self.tab_changed) if self.tab_options: self.tab_options.state_change.connect(self.tab_changed) self.grid_layout.addWidget(self.tab_options, 1, 0) # Keep options stored but don't show corresponding widget in GUI self.tab_options.setVisible(False) self.tab_changed() def tab_changed(self): iPage = self.top_tab.currentIndex() self.pages[iPage].replotTrend(self.tab_options.state())
class MainDialog(QDialog): def __init__(self): QDialog.__init__(self) self.setWindowTitle("qWat") self.resize(360, 500) self.layout = QGridLayout(self) self.tabWidget = QTabWidget() self.tabWidget.addTab(TabNode(), QCoreApplication.translate("main dialog tab", "Nodes")) self.tabWidget.addTab(TabValve(), QCoreApplication.translate("main dialog tab", "Valves")) self.tabWidget.addTab(TabSchematic(), QCoreApplication.translate("main dialog tab", "Schematic")) self.tabWidget.addTab(TabSettings(), QCoreApplication.translate("main dialog tab", "Settings")) self.layout.addWidget(self.tabWidget)
def __init__(self, mainwindow): """Creates the about dialog. You can simply exec_() it.""" super(AboutDialog, self).__init__(mainwindow) self.setWindowTitle(_("About {appname}").format(appname = appinfo.appname)) layout = QVBoxLayout() self.setLayout(layout) tabw = QTabWidget() layout.addWidget(tabw) tabw.addTab(About(self), _("About")) tabw.addTab(Credits(self), _("Credits")) tabw.addTab(Version(self), _("Version")) button = QDialogButtonBox(QDialogButtonBox.Ok) button.setCenterButtons(True) button.accepted.connect(self.accept) layout.addWidget(button) layout.setSizeConstraint(QLayout.SetFixedSize)
class GUIApplication(Application, QObject): selected_instance = None selected_entity = None def __init__(self): super(Application, self).__init__() super(QObject, self).__init__() self.qApp = QApplication([]) # init main window widget self.w = QTabWidget() self.w.resize(1300, 700) self.w.setWindowTitle("# Hello world!") # other init routines self.entity_manager = EntityManager() self.build_layout() self.prepare_result_dirs() self.w.show() def prepare_result_dirs(self): options = CompilerOptions() try: for d in options.get_output_dirs(): makedirs(path.join(OUTPUT_ROOT, d)) except: pass def run(self): self.qApp.exec_() def build_layout(self): self.result_explorer = ResultExplorer(self.entity_manager) self.w.addTab(self.result_explorer, "Result explorer") self.query_explorer = QueryExplorer(self.entity_manager) self.w.addTab(self.query_explorer, "Queries")
def __init__(self): QMainWindow.__init__(self) self.setupUi(self) trayicon = QIcon(os.path.join(sys.path[0],'data/tray.png')) self.tray = TrayIcon() self.tray.setIcon(trayicon) self.tray.setParent(self) self.tray.setContextMenu(self.menuMenu) self.tray.show() self.config = Config() self.client = GUIElement.Client(self.config) if os.name == 'posix': self.server = GUIElement.Server(self.config) self.preferences = GUIElement.Preferences(self.config) mount_tab = QTabWidget() mount_tab.setWindowTitle('NFS Mounter') mount_tab.addTab(self.client, 'Mount') if os.name == 'posix': mount_tab.addTab(self.server, 'Share') mount_tab.addTab(self.preferences, 'Preferences') if os.name == 'posix': nfs = NfsBrowser(self.client) self.setCentralWidget(mount_tab) self.actionAdd.connect(self.actionAdd, SIGNAL("triggered()"), self.client.add_line) self.tray.connect(self.tray, SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), self.on_tray_clicked) self.actionExit.connect(self.actionExit, SIGNAL('triggered()'), self.on_actionExit_clicked)
def __init__(self, authors, translators, parent=None): super(CreditsDialog, self).__init__(parent) self.parent = parent authorsLabel = QPlainTextEdit(authors) authorsLabel.setReadOnly(True) translatorsLabel = QPlainTextEdit(translators) translatorsLabel.setReadOnly(True) TabWidget = QTabWidget() TabWidget.addTab(authorsLabel, self.tr('Written by')) TabWidget.addTab(translatorsLabel, self.tr('Translated by')) closeQPB = QPushButton(self.tr('&Close')) hlayout = utils.add_to_layout('h', None, closeQPB) vlayout = utils.add_to_layout('v', TabWidget, hlayout) self.setLayout(vlayout) closeQPB.clicked.connect(self.close) self.setMinimumSize(QSize(335, 370)) self.setMaximumSize(QSize(335, 370)) self.setWindowTitle(self.tr('Credits'))
class CWidget(QWidget): def __init__(self, parent=None): super(CWidget, self).__init__() self.tabWidget = QTabWidget() self.tabWidget.setTabsClosable(True) self.tables = [] self.files = listFiles('.') allFilesTable = CTableWidget(("Filename", "Filesize", "Path")) allFilesTable.setItems(self.files) self.tabWidget.addTab(allFilesTable, "All Files") self.tables.append((allFilesTable, None)) self.tabWidget.tabCloseRequested.connect(self.tabWidget.removeTab) self.tabWidget.tabBar().tabButton(0, QTabBar.RightSide).resize(0, 0) vbox = QVBoxLayout() vbox.addWidget(self.tabWidget) self.setLayout(vbox) self.addTab('PDF', ("Path", "Filename"), '*.pdf') def addTab(self, tabLabel, tableHeaderLabels, pattern): table = CTableWidget(tableHeaderLabels) table.setItems(filterFiles(self.files, pattern)) self.tables.append((table, pattern)) self.tabWidget.addTab(table, tabLabel) def refreshTables(self): for tableData in self.tables: if tableData[1]: tableData[0].setItems(filterFiles(self.files, tableData[1])) else: tableData[0].setItems(self.files)
class AboutDialog(QDialog): def __init__(self, parent=None): QDialog.__init__(self, parent) self.setFixedSize(500, 500) self.setWindowTitle(utils.tr('About MicroHex')) layout = QVBoxLayout(self) self.label = QLabel(self) self.label.setTextFormat(Qt.RichText) self.label.setText(utils.tr('MicroHex version {0}, (c) 2013 zenwarr<br><a href="{1}">{1}</a>') .format(QCoreApplication.applicationVersion(), QCoreApplication.organizationDomain())) self.label.setOpenExternalLinks(True) self.tabWidget = QTabWidget(self) self.copyingText = QTextBrowser(self) self.copyingText.setOpenExternalLinks(True) self.tabWidget.addTab(self.copyingText, utils.tr('License')) self.creditsText = QTextBrowser(self) self.creditsText.setOpenExternalLinks(True) self.tabWidget.addTab(self.creditsText, utils.tr('Credits')) l_file = QFile(':/main/data/COPYING.html') if l_file.open(QFile.ReadOnly | QFile.Text): self.copyingText.setText(str(l_file.readAll(), encoding='utf-8')) c_file = QFile(':/main/data/CREDITS.html') if c_file.open(QFile.ReadOnly | QFile.Text): self.creditsText.setText(str(c_file.readAll(), encoding='utf-8')) self.okButton = QPushButton(utils.tr('OK'), self) self.okButton.clicked.connect(self.close) self.okButton.setDefault(True) layout.addWidget(self.label) layout.addWidget(self.tabWidget) layout.addWidget(self.okButton)
class PreferencesWidget(QDialog): def __init__(self, parent=None): QDialog.__init__(self, parent) self.setWindowTitle(self.tr("NINJA-IDE - Preferences")) self.setModal(True) self.setMaximumSize(QSize(0, 0)) self.overlay = ui_tools.Overlay(self) self.overlay.hide() #Tabs vbox = QVBoxLayout(self) self._tabs = QTabWidget() self._tabs.setTabPosition(QTabWidget.West) self._tabs.setMovable(False) self._general = GeneralTab() self._interface = InterfaceTab(self) self._editor = EditorTab() self._plugins = plugin_preferences.PluginPreferences() self._tabs.addTab(self._general, self.tr("General")) self._tabs.addTab(self._interface, self.tr("Interface")) self._tabs.addTab(self._editor, self.tr("Editor")) self._tabs.addTab(self._plugins, self.tr("Plugins")) #Buttons (save-cancel) hbox = QHBoxLayout() self._btnSave = QPushButton(self.tr("Save")) self._btnCancel = QPushButton(self.tr("Cancel")) hbox = QHBoxLayout() hbox.addWidget(self._btnCancel) hbox.addWidget(self._btnSave) gridFooter = QGridLayout() gridFooter.addLayout(hbox, 0, 0, Qt.AlignRight) vbox.addWidget(self._tabs) vbox.addLayout(gridFooter) self.connect(self._btnSave, SIGNAL("clicked()"), self._save) self.connect(self._btnCancel, SIGNAL("clicked()"), self.close) def _save(self): for i in xrange(self._tabs.count()): self._tabs.widget(i).save() self.close() def resizeEvent(self, event): self.overlay.resize(event.size()) event.accept()
def create_main_frame(self): self.main_frame = QWidget() self.main_frame1 = QWidget() self.dpi = 100 self.fig = Figure((5.0, 5.0), dpi=self.dpi) self.canvas = FigureCanvas(self.fig) self.canvas.setParent(self.main_frame) self.dpi1 = 100 self.fig1 = Figure((5.0, 5.0), dpi=self.dpi1) self.canvas1 = FigureCanvas(self.fig1) self.canvas1.setParent(self.main_frame1) self.axes = p3.Axes3D(self.fig) self.axes1 = p3.Axes3D(self.fig1) self.canvas.mpl_connect('pick_event', self.on_pick) self.canvas1.mpl_connect('pick_event', self.on_pick) self.mpl_toolbar = NavigationToolbar(self.canvas, self.main_frame) self.mpl_toolbar1 = NavigationToolbar(self.canvas1, self.main_frame1) tab_widget = QTabWidget() tab1 = QWidget() tab2 = QWidget() tab3 = QWidget() vbox1 = QVBoxLayout(tab1) vbox1.addWidget(self.canvas) vbox1.addWidget(self.mpl_toolbar) vbox2 = QVBoxLayout(tab2) vbox2.addWidget(self.canvas1) vbox2.addWidget(self.mpl_toolbar1) tab_widget.addTab(tab1, u"n=1.7125(ТФ3)") tab_widget.addTab(tab2, u"n=2.417") vbox = QVBoxLayout() vbox.addWidget(tab_widget) self.main_frame.setLayout(vbox) self.setCentralWidget(self.main_frame)
class MainWindow(QMainWindow): """ Main window for the player application. """ def __init__(self, bind_address: str, port: int, filesToRead: [str]): """ :param bind_address: address to bind to when listening for live connections. :param port: port to bind to when listening for live connections. :param filesToRead: replay files to open. """ QMainWindow.__init__(self) self.liveWindow = LivePlayerWindow(bind_address, port) self.replayWindow = ReplayWindow() self.tabManager = QTabWidget() self.tabManager.addTab(self.replayWindow, "Replays") self.tabManager.addTab(self.liveWindow, "Live connections") self.setCentralWidget(self.tabManager) openAction = QAction("Open...", self) openAction.setShortcut("Ctrl+O") openAction.setStatusTip("Open a replay file") openAction.triggered.connect(self.onOpenFile) menuBar = self.menuBar() fileMenu = menuBar.addMenu("File") fileMenu.addAction(openAction) for fileName in filesToRead: self.replayWindow.openFile(fileName) def onOpenFile(self): fileName = QFileDialog.getOpenFileName(self, "Open File") if fileName: self.replayWindow.openFile(fileName)
class TabDocker(QWidget): """ Tab widget for the settingswidgets. Inherits: QWidget """ def __init__(self, parent=None, **kwargs): """ Initialise layout for TabDocker Arguments: parent - Parent widget (default None) Return: None """ super(TabDocker, self).__init__(parent) layout = QVBoxLayout(self) self.tab_widget = QTabWidget(self) self.tab_widget.setObjectName('tab') layout.addWidget(self.tab_widget) def add_tab(self, widget, name): """ Add a new tab to the TabDocker Arguments: widget - Widget to add name - Name of the widget Return: None """ self.tab_widget.addTab(widget, name)
class MainDialog(QDialog): def __init__(self): QDialog.__init__(self) self.setWindowTitle("qWat") self.resize(360, 500) self.layout = QGridLayout(self) self.tabWidget = QTabWidget() self.tabWidget.addTab( TabNode(), QCoreApplication.translate("main dialog tab", "Nodes")) self.tabWidget.addTab( TabValve(), QCoreApplication.translate("main dialog tab", "Valves")) self.tabWidget.addTab( TabSchematic(), QCoreApplication.translate("main dialog tab", "Schematic")) self.tabWidget.addTab( TabSettings(), QCoreApplication.translate("main dialog tab", "Settings")) self.layout.addWidget(self.tabWidget)
class PreferencesWindow(QDialog): def __init__(self, main): QDialog.__init__(self, main) self.setWindowTitle('NINJA - Preferences') self.setMaximumSize(QSize(0, 0)) #self.setFixedWidth(600) self.setModal(True) self._main = main #Tabs vbox = QVBoxLayout(self) self.tabs = QTabWidget() self.tabs.setTabPosition(QTabWidget.West) self.tabs.setMovable(False) self.general = GeneralTab() self.interface = InterfaceTab(self._main) self.skins = SkinsTab() self.editor = EditorTab(self._main) self.tabs.addTab(self.general, 'General') self.tabs.addTab(self.interface, 'Interface') self.tabs.addTab(self.editor, 'Editor') self.tabs.addTab(self.skins, 'Skins') #Buttons (save-cancel) hbox = QHBoxLayout() self.btnSave = QPushButton('Save') self.btnCancel = QPushButton('Cancel') hbox = QHBoxLayout() hbox.addWidget(self.btnCancel) hbox.addWidget(self.btnSave) gridFooter = QGridLayout() gridFooter.addLayout(hbox, 0, 0, Qt.AlignRight) vbox.addWidget(self.tabs) vbox.addLayout(gridFooter) self.connect(self.btnSave, SIGNAL("clicked()"), self._save) self.connect(self.btnCancel, SIGNAL("clicked()"), self.close) def _save(self): for i in range(self.tabs.count()): self.tabs.widget(i).save() self.close()
class FormTabWidget(QWidget): def __init__(self, datalist, comment="", parent=None): super(FormTabWidget, self).__init__(parent) layout = QVBoxLayout() self.tabwidget = QTabWidget() layout.addWidget(self.tabwidget) self.setLayout(layout) self.widgetlist = [] for data, title, comment in datalist: if len(data[0])==3: widget = FormComboWidget(data, comment=comment, parent=self) else: widget = FormWidget(data, comment=comment, parent=self) index = self.tabwidget.addTab(widget, title) self.tabwidget.setTabToolTip(index, comment) self.widgetlist.append(widget) def get(self): return [ widget.get() for widget in self.widgetlist]
def __init__(self, parent): super(DialogAbout, self).__init__(parent) self.setWindowTitle(_('About')) layout = QVBoxLayout(self) self.setLayout(layout) buttons = QDialogButtonBox(QDialogButtonBox.Ok) buttons.accepted.connect(self.accept) tabs = QTabWidget(parent) tabs.setDocumentMode(True) tabs.addTab(self._create_about_tab(), _('About')) tabs.addTab(self._create_developers_tab(), _('Developers')) tabs.addTab(self._create_translators_tab(), _('Translators')) layout.addWidget(tabs) layout.addWidget(buttons)
def __createLayout(self): " Creates the dialog layout " self.resize(640, 480) self.setSizeGripEnabled(True) vboxLayout = QVBoxLayout(self) hboxLayout = QHBoxLayout() iconLabel = QLabel() iconLabel.setPixmap(PixmapCache().getPixmap("logo-48x48.png")) iconLabel.setScaledContents(False) hboxLayout.addWidget(iconLabel) versionLabel = QLabel( "<b>Codimension IDE version " + str(GlobalData().version) + "<br>" "CML version " + str(CMLVersion.VERSION) + "</b><p>Copyright (c) Sergey Satskiy 2010-2016</p>") versionLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) versionLabel.setFixedHeight(versionLabel.minimumSizeHint().height()) versionLabel.setAlignment(Qt.AlignCenter) hboxLayout.addWidget(versionLabel) vboxLayout.addLayout(hboxLayout) tabWidget = QTabWidget(self) tabWidget.setFocusPolicy(Qt.NoFocus) description = self.__createDescription() tabWidget.addTab(description, "About") versioning = self.__createVersioning() tabWidget.addTab(versioning, "Versions and licenses") authors = self.__createAuthors() tabWidget.addTab(authors, "Contributors") vboxLayout.addWidget(tabWidget) # Button at the bottom buttonBox = QDialogButtonBox(self) buttonBox.setOrientation(Qt.Horizontal) buttonBox.setStandardButtons(QDialogButtonBox.Ok) buttonBox.accepted.connect(self.close) buttonBox.rejected.connect(self.close) vboxLayout.addWidget(buttonBox) return