Python PyQt5.QtWidgets.QStackedWidget() Examples

The following are 16 code examples for showing how to use PyQt5.QtWidgets.QStackedWidget(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .

Example 1
Project: awesometts-anki-addon   Author: AwesomeTTS   File: base.py    License: GNU General Public License v3.0 6 votes vote down vote up
def _get_service_values(self):
        """
        Return the service ID and a dict of all the options.
        """

        dropdown = self.findChild(QtWidgets.QComboBox, 'service')
        idx = dropdown.currentIndex()
        svc_id = dropdown.itemData(idx)
        if svc_id.startswith('group:'):
            return svc_id, None

        vinputs = self.findChild(QtWidgets.QStackedWidget, 'panels') \
            .widget(idx).findChildren(self._OPTIONS_WIDGETS)
        options = self._addon.router.get_options(svc_id)

        assert len(options) == len(vinputs)

        return svc_id, {
            options[i]['key']:
                vinputs[i].value()
                if isinstance(vinputs[i], QtWidgets.QAbstractSpinBox)
                else vinputs[i].itemData(vinputs[i].currentIndex())
            for i in range(len(options))
        } 
Example 2
Project: Openroast   Author: Roastero   File: mainwindow.py    License: GNU General Public License v3.0 6 votes vote down vote up
def create_tabs(self, roaster, recipes):
        self.tabs = QtWidgets.QStackedWidget()

        # Create widgets to add to tabs.
        self.roast = roasttab.RoastTab(
            roaster, recipes)
        self.recipes = recipestab.RecipesTab(
            roastTabObject=self.roast,
            MainWindowObject=self,
            recipes_object=self.recipes)

        # Add widgets to tabs.
        self.tabs.insertWidget(0, self.roast)
        self.tabs.insertWidget(1, self.recipes)

        # Set the tabs as the central widget.
        self.setCentralWidget(self.tabs)

        # Set the roast button disabled.
        self.roastTabButton.setEnabled(False) 
Example 3
Project: mindfulness-at-the-computer   Author: mindfulness-at-the-computer   File: intro_dlg.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        super().__init__()

        self.wizard_qsw_w3 = QtWidgets.QStackedWidget()
        self.prev_qpb = QtWidgets.QPushButton(PREV_STR)
        self.next_qpb = QtWidgets.QPushButton(NEXT_STR)

        self.initial_setup = TimingInitSetupPage()
        self._init_ui() 
Example 4
Project: pyleecan   Author: Eomys   File: SidebarWindow.py    License: Apache License 2.0 5 votes vote down vote up
def __init__(self):
        # === App-Init ===
        super(SidebarWindow, self).__init__()
        self._title = "Pyleecan"
        self.setWindowTitle(self._title)
        self._main = QtWidgets.QWidget()
        self.setCentralWidget(self._main)

        # === Main Widgets ===
        # Navigation Panel with Button Group
        self.nav_panel = QtWidgets.QFrame()

        self.nav_btn_grp = QtWidgets.QButtonGroup()
        self.nav_btn_grp.setExclusive(True)
        self.nav_btn_grp.buttonClicked[int].connect(self.switch_stack)
        self.btn_grp_fct = []

        self.nav_layout = QtWidgets.QVBoxLayout(self.nav_panel)
        self.nav_layout.setContentsMargins(2, 2, 2, 2)
        self.nav_layout.addStretch(1)  # add stretch first

        # Sub Window Stack
        self.io_stack = QtWidgets.QStackedWidget(self)

        # Seperator Line
        line = QtWidgets.QFrame()
        line.setStyleSheet("QFrame { background-color: rgb(200, 200, 200) }")
        line.setFixedWidth(2)

        # === Main Layout ===
        main_layout = QtWidgets.QHBoxLayout()
        main_layout.addWidget(self.nav_panel)
        main_layout.addWidget(line)
        main_layout.addWidget(self.io_stack)

        self._main.setLayout(main_layout)

        self.show()
        self.centerOnScreen() 
Example 5
Project: heap-viewer   Author: danigargu   File: structs.py    License: GNU General Public License v3.0 5 votes vote down vote up
def _create_gui(self):
        self.cb_struct = QtWidgets.QComboBox()
        self.cb_struct.setFixedWidth(150)
        self.cb_struct.addItem('malloc_state')
        self.cb_struct.addItem('malloc_par')
        self.cb_struct.addItem('tcache_perthread')
        self.cb_struct.currentIndexChanged[int].connect(self.cb_struct_changed)

        self.widgets = {
            'malloc_state': StructView(self),
            'malloc_par': StructView(self),
            'tcache_perthread': StructView(self)
        }

        self.stacked = QtWidgets.QStackedWidget()
        self.stacked.addWidget(self.widgets['malloc_state'])
        self.stacked.addWidget(self.widgets['malloc_par'])
        self.stacked.addWidget(self.widgets['tcache_perthread'])

        self.btn_load = QtWidgets.QPushButton("Load")
        self.btn_load.clicked.connect(self.btn_load_on_click)

        hbox_struct = QtWidgets.QHBoxLayout()
        hbox_struct.addWidget(QtWidgets.QLabel("Struct"))
        hbox_struct.addWidget(self.cb_struct)
        hbox_struct.addWidget(self.btn_load)
        hbox_struct.addStretch(1)
        
        layout = QtWidgets.QVBoxLayout()
        layout.addLayout(hbox_struct)
        layout.addWidget(self.stacked)
        self.setLayout(layout) 
Example 6
Project: heap-viewer   Author: danigargu   File: magic.py    License: GNU General Public License v3.0 5 votes vote down vote up
def _create_gui(self):
        self.cb_magic = QtWidgets.QComboBox()
        self.cb_magic.setFixedWidth(200)
        self.cb_magic.addItem('Unlink merge info', 0)
        self.cb_magic.addItem('Find fake fast', 0)
        self.cb_magic.addItem('House of force helper', 0)
        self.cb_magic.addItem('Useful libc offsets')
        self.cb_magic.addItem('Calc chunk size')
        self.cb_magic.addItem('IO_FILE structs')
        self.cb_magic.addItem('Freeable chunk')
        self.cb_magic.currentIndexChanged[int].connect(self.cb_magic_changed)

        self.stacked_magic = QtWidgets.QStackedWidget()

        self.unlink_widget = UnlinkWidget(self)
        self.fakefast_widget = FakefastWidget(self)
        self.house_of_force_widget = HouseOfForceWidget(self)
        self.libc_offsets_widget = LibcOffsetsWidget(self)
        self.req2size_widget = Req2sizeWidget(self)
        self.io_file_widget = IOFileWidget(self)
        self.freeable_widget = FreeableWidget(self)

        self.stacked_magic.addWidget(self.unlink_widget)
        self.stacked_magic.addWidget(self.fakefast_widget)
        self.stacked_magic.addWidget(self.house_of_force_widget)
        self.stacked_magic.addWidget(self.libc_offsets_widget)
        self.stacked_magic.addWidget(self.req2size_widget)
        self.stacked_magic.addWidget(self.io_file_widget)
        self.stacked_magic.addWidget(self.freeable_widget)

        hbox_magic = QtWidgets.QHBoxLayout()
        hbox_magic.addWidget(QtWidgets.QLabel('Select util'))
        hbox_magic.addWidget(self.cb_magic)
        hbox_magic.addStretch(1)

        self.vbox_magic = QtWidgets.QVBoxLayout()
        self.vbox_magic.addLayout(hbox_magic)
        self.vbox_magic.addWidget(self.stacked_magic)
        self.setLayout(self.vbox_magic) 
Example 7
Project: pychemqt   Author: jjgomera   File: UI_Preferences.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, config, parent=None):
        """Constructor, opcional config parameter to input project config"""
        super(Preferences, self).__init__(parent)
        self.config = config
        self.setWindowTitle(
            QtWidgets.QApplication.translate("pychemqt", "Preferences"))

        layout = QtWidgets.QGridLayout(self)
        self.lista = QtWidgets.QListWidget()
        self.lista.setIconSize(QtCore.QSize(20, 20))
        self.lista.setSizePolicy(
            QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
        layout.addWidget(self.lista, 1, 1)
        self.stacked = QtWidgets.QStackedWidget()
        layout.addWidget(self.stacked, 1, 2)
        for icon, dialog, title in self.classes:
            self.stacked.addWidget(dialog(config))
            icon = QtGui.QIcon(QtGui.QPixmap(
                os.environ["pychemqt"]+"/images/%s" % icon))
            self.lista.addItem(QtWidgets.QListWidgetItem(icon, title))

        self.lista.currentRowChanged.connect(self.stacked.setCurrentIndex)
        self.buttonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        layout.addWidget(self.buttonBox, 2, 2) 
Example 8
Project: pandasgui   Author: adamerose   File: gui.py    License: MIT License 5 votes vote down vote up
def setupUI(self):
        """
        Creates and adds all widgets to GUI.
        """

        # This holds the DataFrameExplorer for each DataFrame
        self.stacked_widget = QtWidgets.QStackedWidget()

        # Make the navigation bar
        self.nav_tree = self.NavWidget(self)
        # Creates the headers.
        self.nav_tree.setHeaderLabels(['Name', 'Shape'])
        self.nav_tree.itemSelectionChanged.connect(self.nav_clicked)

        for df_name in self.df_dicts.keys():
            df_object = self.df_dicts[df_name]['dataframe']
            self.add_dataframe(df_name, df_object)

        # Make splitter to hold nav and DataFrameExplorers
        self.splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal)
        self.splitter.addWidget(self.nav_tree)
        self.splitter.addWidget(self.stacked_widget)

        self.splitter.setCollapsible(0, False)
        self.splitter.setCollapsible(1, False)
        self.splitter.setStretchFactor(0, 0)
        self.splitter.setStretchFactor(1, 1)

        nav_width = self.nav_tree.sizeHint().width()
        self.splitter.setSizes([nav_width, self.width() - nav_width])
        self.splitter.setContentsMargins(10, 10, 10, 10)

        # makes the find toolbar
        self.findBar = FindToolbar(self)
        self.addToolBar(self.findBar)

        # QMainWindow setup
        self.make_menu_bar()
        self.setCentralWidget(self.splitter) 
Example 9
Project: Lector   Author: BasioMeusPuga   File: mainwindow.py    License: GNU General Public License v3.0 4 votes vote down vote up
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1049, 720)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
        self.tabWidget.setTabsClosable(True)
        self.tabWidget.setObjectName("tabWidget")
        self.tab = QtWidgets.QWidget()
        self.tab.setObjectName("tab")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.tab)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.stackedWidget = QtWidgets.QStackedWidget(self.tab)
        self.stackedWidget.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.stackedWidget.setLineWidth(0)
        self.stackedWidget.setObjectName("stackedWidget")
        self.listPage = QtWidgets.QWidget()
        self.listPage.setObjectName("listPage")
        self.gridLayout_4 = QtWidgets.QGridLayout(self.listPage)
        self.gridLayout_4.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_4.setSpacing(0)
        self.gridLayout_4.setObjectName("gridLayout_4")
        self.stackedWidget.addWidget(self.listPage)
        self.tablePage = QtWidgets.QWidget()
        self.tablePage.setObjectName("tablePage")
        self.gridLayout_3 = QtWidgets.QGridLayout(self.tablePage)
        self.gridLayout_3.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_3.setSpacing(0)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.stackedWidget.addWidget(self.tablePage)
        self.gridLayout_2.addWidget(self.stackedWidget, 0, 0, 1, 1)
        self.tabWidget.addTab(self.tab, "")
        self.horizontalLayout.addWidget(self.tabWidget)
        self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusBar = QtWidgets.QStatusBar(MainWindow)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.statusBar.sizePolicy().hasHeightForWidth())
        self.statusBar.setSizePolicy(sizePolicy)
        self.statusBar.setMinimumSize(QtCore.QSize(0, 0))
        self.statusBar.setObjectName("statusBar")
        MainWindow.setStatusBar(self.statusBar)

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
Example 10
Project: awesometts-anki-addon   Author: AwesomeTTS   File: base.py    License: GNU General Public License v3.0 4 votes vote down vote up
def _ui_services(self):
        """
        Return the service panel, which includes a dropdown for the
        service and a stacked widget for each service's options.
        """

        dropdown = QtWidgets.QComboBox()
        dropdown.setObjectName('service')

        stack = QtWidgets.QStackedWidget()
        stack.setObjectName('panels')

        for svc_id, text in self._addon.router.get_services():
            dropdown.addItem(text, svc_id)

            svc_layout = QtWidgets.QGridLayout()
            svc_layout.addWidget(Label("Pass the following to %s:" % text),
                                 0, 0, 1, 2)

            svc_widget = QtWidgets.QWidget()
            svc_widget.setLayout(svc_layout)

            stack.addWidget(svc_widget)
        self._svc_count = dropdown.count()

        # one extra widget for displaying a group
        group_layout = QtWidgets.QVBoxLayout()
        group_layout.addWidget(Note())
        group_layout.addStretch()
        group_widget = QtWidgets.QWidget()
        group_widget.setLayout(group_layout)
        stack.addWidget(group_widget)

        dropdown.activated.connect(self._on_service_activated)
        dropdown.currentIndexChanged.connect(self._on_preset_reset)

        hor = QtWidgets.QHBoxLayout()
        hor.addWidget(Label("Generate using"))
        hor.addWidget(dropdown)
        hor.addStretch()

        header = Label("Configure Service")
        header.setFont(self._FONT_HEADER)

        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(header)
        layout.addLayout(hor)
        layout.addWidget(stack)
        layout.addStretch()
        layout.addLayout(self._ui_services_presets())

        return layout 
Example 11
Project: awesometts-anki-addon   Author: AwesomeTTS   File: base.py    License: GNU General Public License v3.0 4 votes vote down vote up
def _on_service_activated(self, idx, initial=False, use_options=None):
        """
        Construct the target widget if it has not already been built,
        recall the last-used values for the options, and then switch the
        stack to it.
        """

        combo = self.findChild(QtWidgets.QComboBox, 'service')
        svc_id = combo.itemData(idx)
        stack = self.findChild(QtWidgets.QStackedWidget, 'panels')
        save = self.findChild(QtWidgets.QPushButton, 'presets_save')

        if svc_id.startswith('group:'):  # we handle groups differently
            svc_id = svc_id[6:]
            group = self._addon.config['groups'][svc_id]
            presets = [preset for preset in group['presets'] if preset]

            stack.setCurrentIndex(stack.count() - 1)
            stack.widget(stack.count() - 1).findChild(QtWidgets.QLabel).setText(
                svc_id +
                (" has no presets yet." if len(presets) == 0
                 else " uses " + presets[0] + "." if len(presets) == 1
                 else ((" randomly selects" if group['mode'] == 'random'
                        else " tries in-order") + " from:\n -" +
                       "\n -".join(presets[0:5]) +
                       ("\n    (... and %d more)" % (len(presets) - 5)
                        if len(presets) > 5 else ""))) +
                "\n\n"
                "Go to AwesomeTTS config for group setup.\n"
                "Access preset options in dropdown below."
            )
            save.setEnabled(False)
            return

        save.setEnabled(True)
        panel_unbuilt = svc_id not in self._panel_built
        panel_unset = svc_id not in self._panel_set

        if panel_unbuilt or panel_unset or use_options:
            widget = stack.widget(idx)
            options = self._addon.router.get_options(svc_id)

            if panel_unbuilt:
                self._panel_built[svc_id] = True
                self._on_service_activated_build(svc_id, widget, options)

            if panel_unset or use_options:
                self._panel_set[svc_id] = True
                self._on_service_activated_set(svc_id, widget, options,
                                               use_options)

        stack.setCurrentIndex(idx)

        if panel_unbuilt and not initial:
            self.adjustSize()

        self._svc_id = svc_id
        help_svc = self.findChild(QtWidgets.QAction, 'help_svc')
        if help_svc:
            help_svc.setText("Using the %s service" % combo.currentText()) 
Example 12
Project: pychemqt   Author: jjgomera   File: UI_corriente.py    License: GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, parent=None):
        super(SolidDistribution, self).__init__(parent)
        self.setWindowTitle(QtWidgets.QApplication.translate(
            "pychemqt", "Generate solid distribution"))
        self.matriz = []

        layout = QtWidgets.QGridLayout(self)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Model")), 0, 0)
        self.modelo = QtWidgets.QComboBox()
        layout.addWidget(self.modelo, 0, 1)
        self.stacked = QtWidgets.QStackedWidget()
        self.modelo.currentIndexChanged.connect(self.stacked.setCurrentIndex)
        layout.addWidget(self.stacked, 1, 0, 1, 2)

        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Standards:")), 2, 0, 1, 1)
        self.standard = QtWidgets.QComboBox()
        self.standard.addItem("Tyler")
        self.standard.addItem("ASTM")
        self.standard.addItem("DIN")
        self.standard.addItem("BS")
        self.standard.addItem("AFNOR")
        self.standard.addItem("ISO")
        self.standard.addItem(QtWidgets.QApplication.translate("pychemqt", "Custom"))
        self.standard.currentIndexChanged[str].connect(self.standardCambiado)
        layout.addWidget(self.standard, 2, 1, 1, 1)

        self.diametros = QtWidgets.QLineEdit()
        layout.addWidget(self.diametros, 3, 1, 1, 2)

        layout.addItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                         QtWidgets.QSizePolicy.Expanding), 4, 1, 1, 3)
        self.buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Cancel |
                                                QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.rejected.connect(self.reject)
        self.buttonBox.accepted.connect(self.aceptar)
        layout.addWidget(self.buttonBox, 5, 0, 1, 2)

        self.entries = {}
        for key in ("Rosin Rammler Sperling", "Gates Gaudin Schumann",
                    "Broadbent Callcott", "Gaudin Meloy", "Lognormal", "Harris"):
            widget = QtWidgets.QWidget()
            self.modelo.addItem(key)
            lyt = QtWidgets.QGridLayout(widget)
            for i, label in enumerate(self.model[key]["title"]):
                lyt.addWidget(QtWidgets.QLabel(label), i, 1)
            self.entries[key] = []
            for i, unit in enumerate(self.model[key]["unit"]):
                entry = Entrada_con_unidades(unit, self.model[key]["magnitud"][i])
                self.entries[key].append(entry)
                lyt.addWidget(entry, i, 2)
            lyt.addItem(QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding,
                                          QtWidgets.QSizePolicy.Expanding), i+1, 1)
            self.stacked.addWidget(widget)

        self.standardCambiado("Tyler") 
Example 13
Project: pychemqt   Author: jjgomera   File: UI_Preferences.py    License: GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, config, parent=None):
        super(ConfTooltipEntity, self).__init__(parent)

        layout = QtWidgets.QVBoxLayout(self)
        self.eleccion = QtWidgets.QComboBox()
        layout.addWidget(self.eleccion)
        self.stacked = QtWidgets.QStackedWidget()
        self.eleccion.currentIndexChanged.connect(self.stacked.setCurrentIndex)
        layout.addWidget(self.stacked)

        self.tabla = [QtWidgets.QTableWidget()]
        self.tabla[0].setRowCount(len(corriente.Corriente.propertiesNames()))
        self.tabla[0].setColumnCount(1)
        self.tabla[0].setColumnWidth(0, 16)
        self.tabla[0].setItemDelegateForColumn(0, CheckEditor(self))
        self.tabla[0].horizontalHeader().setVisible(False)
        self.stacked.addWidget(self.tabla[0])
        self.eleccion.addItem(
            QtWidgets.QApplication.translate("pychemqt", "Stream"))

        for i, propiedad in enumerate(corriente.Corriente.propertiesNames()):
            item = QtWidgets.QTableWidgetItem(propiedad[0])
            self.tabla[0].setVerticalHeaderItem(i, item)
            self.tabla[0].setRowHeight(i, 24)
            self.tabla[0].setItem(i, 0, QtWidgets.QTableWidgetItem(""))
            self.tabla[0].item(i, 0).setTextAlignment(
                QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
            self.tabla[0].openPersistentEditor(self.tabla[0].item(i, 0))

        if config.has_option("TooltipEntity", "Corriente"):
            lista = eval(config.get("TooltipEntity", "Corriente"))
            for i in lista:
                self.tabla[0].item(i, 0).setText("true")

        for i, equipo in enumerate(equipments):
            propiedades = [prop[0] for prop in equipo.propertiesNames()]
            self.tabla.append(QtWidgets.QTableWidget())
            self.stacked.addWidget(self.tabla[-1])
            self.tabla[-1].setRowCount(len(propiedades))
            self.tabla[-1].setColumnCount(1)
            self.tabla[-1].setColumnWidth(0, 16)
            self.tabla[-1].setItemDelegateForColumn(0, CheckEditor(self))
            self.tabla[-1].horizontalHeader().setVisible(False)
            for j, propiedad in enumerate(propiedades):
                item = QtWidgets.QTableWidgetItem(propiedad)
                self.tabla[-1].setVerticalHeaderItem(j, item)
                self.tabla[-1].setRowHeight(j, 24)
                self.tabla[-1].setItem(j, 0, QtWidgets.QTableWidgetItem(""))
                self.tabla[-1].item(j, 0).setTextAlignment(
                    QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
                self.tabla[-1].openPersistentEditor(self.tabla[-1].item(j, 0))
            self.rellenar(equipo.__name__, i+1, config)
            self.eleccion.addItem(equipo.title) 
Example 14
Project: django-pyqt   Author: ZedObaia   File: mainWindow.py    License: MIT License 4 votes vote down vote up
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(428, 242)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName("verticalLayout")
        self.stackedWidget = QtWidgets.QStackedWidget(self.centralwidget)
        self.stackedWidget.setObjectName("stackedWidget")
        self.page = QtWidgets.QWidget()
        self.page.setObjectName("page")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.page)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.username = QtWidgets.QLineEdit(self.page)
        self.username.setObjectName("username")
        self.verticalLayout_2.addWidget(self.username)
        self.password = QtWidgets.QLineEdit(self.page)
        self.password.setObjectName("password")
        self.verticalLayout_2.addWidget(self.password)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.addUserBtn = QtWidgets.QPushButton(self.page)
        self.addUserBtn.setObjectName("addUserBtn")
        self.horizontalLayout.addWidget(self.addUserBtn)
        self.authBtn = QtWidgets.QPushButton(self.page)
        self.authBtn.setObjectName("authBtn")
        self.horizontalLayout.addWidget(self.authBtn)
        self.verticalLayout_2.addLayout(self.horizontalLayout)
        self.stackedWidget.addWidget(self.page)
        self.page_2 = QtWidgets.QWidget()
        self.page_2.setObjectName("page_2")
        self.stackedWidget.addWidget(self.page_2)
        self.verticalLayout.addWidget(self.stackedWidget)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 428, 32))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
Example 15
Project: asammdf   Author: danielhrisca   File: main_window.py    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
def setupUi(self, PyMDFMainWindow):
        PyMDFMainWindow.setObjectName("PyMDFMainWindow")
        PyMDFMainWindow.resize(800, 723)
        icon = QtGui.QIcon()
        icon.addPixmap(
            QtGui.QPixmap(":/asammdf.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off
        )
        PyMDFMainWindow.setWindowIcon(icon)
        self.centralwidget = QtWidgets.QWidget(PyMDFMainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setSpacing(2)
        self.verticalLayout.setObjectName("verticalLayout")
        self.stackedWidget = QtWidgets.QStackedWidget(self.centralwidget)
        self.stackedWidget.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.stackedWidget.setObjectName("stackedWidget")
        self.stackedWidgetPage1 = QtWidgets.QWidget()
        self.stackedWidgetPage1.setObjectName("stackedWidgetPage1")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.stackedWidgetPage1)
        self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_2.setSpacing(2)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.files = QtWidgets.QTabWidget(self.stackedWidgetPage1)
        self.files.setDocumentMode(False)
        self.files.setTabsClosable(True)
        self.files.setObjectName("files")
        self.verticalLayout_2.addWidget(self.files)
        self.stackedWidget.addWidget(self.stackedWidgetPage1)
        self.verticalLayout.addWidget(self.stackedWidget)
        PyMDFMainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(PyMDFMainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
        self.menubar.setObjectName("menubar")
        PyMDFMainWindow.setMenuBar(self.menubar)
        self.action_memory_minimum = QtWidgets.QAction(PyMDFMainWindow)
        self.action_memory_minimum.setCheckable(True)
        self.action_memory_minimum.setObjectName("action_memory_minimum")
        self.action_memory_full = QtWidgets.QAction(PyMDFMainWindow)
        self.action_memory_full.setCheckable(True)
        self.action_memory_full.setObjectName("action_memory_full")
        self.action_memory_low = QtWidgets.QAction(PyMDFMainWindow)
        self.action_memory_low.setCheckable(True)
        self.action_memory_low.setObjectName("action_memory_low")

        self.retranslateUi(PyMDFMainWindow)
        self.stackedWidget.setCurrentIndex(0)
        self.files.setCurrentIndex(-1)
        QtCore.QMetaObject.connectSlotsByName(PyMDFMainWindow) 
Example 16
Project: binja_dynamics   Author: nccgroup   File: __init__.py    License: Apache License 2.0 4 votes vote down vote up
def __init__(self, segments=None):
        """
        Initializes GUI components.
        Takes either no arguments, or a dict containing segment names and starting addresses
        """
        super(MemoryWindow, self).__init__()
        self.setWindowTitle("Memory")
        self.stack_pointer = None
        self.base_pointer = None
        self.retn_address = None
        self.instr_pointer = None

        if segments is not None:
            if type(segments) is not OrderedDict:
                print("Error: Use collections.OrderedDict instead of dict for segment list")
            self._segments = segments.keys()
            self.segment_starts = segments

        self.setLayout(QtWidgets.QVBoxLayout())
        self._layout = self.layout()

        self._picker = QtWidgets.QComboBox()
        for segment in self._segments:
            self._picker.addItem(segment)
        self._layout.addWidget(self._picker)
        # Call change_display_segment whenever the user messes with the combobox
        self._picker.currentIndexChanged.connect(self.change_display_segment)

        # viewstack controls switching between the different segments views
        self.viewstack = QtWidgets.QStackedWidget()
        for segment in self._segments:
            if self.segment_starts is None:
                disp = HexDisplay()
                disp.update_addr(0, "This is the " + segment + " segment")
            else:
                disp = HexDisplay(starting_address=self.segment_starts[segment])
            self.viewstack.addWidget(disp)

        self._layout.addWidget(self.viewstack)
        self.setMaximumWidth(self.viewstack.widget(0).maximumWidth() + 20)
        self.setMinimumWidth(self.viewstack.widget(0).minimumWidth() + 20)
        self.setObjectName('Memory_Window')