예제 #1
0
class LoggerWidget(QWidget):
    def __init__(self, parent=None):
        super(LoggerWidget, self).__init__(parent)
        self.logOutput = QTextEdit()
        self.logOutput.setReadOnly(True)
        self.logOutput.setLineWrapMode(QTextEdit.NoWrap)
        self.logOutput.moveCursor(QTextCursor.End)
        #self.font = self.logOutput.font()
        #self.font.setFamily("Courier")
        #self.font.setPointSize(10)
        #self.logOutput.setCurrentFont(font)
        #self.logOutput.setTextColor(color)
        #self.logOutput.resize(800,200)
        #self.setMinimumWidth(1000)

        self.tab_widget = QTabWidget(self)
        self.tab_widget.addTab(self.logOutput, "EventsLogger")

        policy = self.logOutput.sizePolicy()
        policy.setVerticalStretch(1)
        policy.setHorizontalStretch(1)
        self.logOutput.setSizePolicy(policy)
        self.tab_widget.setSizePolicy(policy)

        self.Layout = QFormLayout()
        self.Layout.addWidget(self.tab_widget)
        self.setLayout(self.Layout)

        self.updateSig = UpdateSig()
        self.restartSig = UpdateSig()

    def readSampleAndUpdateLogger(self, line, param_t1, is_start, is_stop):
        if "BML_EVENT" in line:
            self.logOutput.insertPlainText(line)
            self.logOutput.moveCursor(QTextCursor.End)
    def __init__(self, game: Game, parent) -> None:
        super().__init__(parent)
        self.setMinimumSize(500, 800)
        self.setWindowTitle(f"Air Wing Configuration")
        # TODO: self.setWindowIcon()

        layout = QVBoxLayout()
        self.setLayout(layout)

        doc_label = QLabel(
            "Use this opportunity to customize the squadrons available to your "
            "coalition. <strong>This is your only opportunity to make changes.</strong>"
            "<br /><br />"
            "To accept your changes and continue, close this window.")

        layout.addWidget(doc_label)

        tab_widget = QTabWidget()
        layout.addWidget(tab_widget)

        self.tabs = []
        for coalition in game.coalitions:
            coalition_tab = AirWingConfigurationTab(coalition, game)
            name = "Blue" if coalition.player else "Red"
            tab_widget.addTab(coalition_tab, name)
            self.tabs.append(coalition_tab)
예제 #3
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self._ui = Ui_CreditsDialog()
        self._ui.setupUi(self)

        creditsTab = QTabWidget()
        creditSections = list(info.CREDITS.keys())
        for creditSection in creditSections:
            creditTab = QWidget()
            creditsTab.addTab(creditTab, creditSection)
            vbox = QVBoxLayout(creditTab)
            creditList = ""
            for person in info.CREDITS[creditSection]:
                creditList += ("\n%s [%s]" % (person['name'], person['email']))
            creditLabel = QLabel()
            creditLabel.setMargin(15)
            creditLabel.setStyleSheet("QLabel { background-color : white; color: black}")
            creditLabel.setText(creditList)
            creditLabel.setAlignment(Qt.AlignTop | Qt.AlignLeft)
            vbox.addWidget(creditLabel)

        vbox = QVBoxLayout()
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.addWidget(creditsTab)
        self._ui.frame_CreditsTab.setLayout(vbox)
예제 #4
0
    def __init__(self, parent=None):
        super().__init__(Qt.Horizontal, parent)

        self.table_model = TableModel(self)

        self.table_view = TableView()
        self.table_view.setModel(self.table_model)

        self.item_widget = ItemWidget()
        self.bibtex_widget = BibTeXWidget()
        self.table_view.ItemSelected.connect(self.item_widget.DisplayItem)
        self.table_view.ItemSelected.connect(self.bibtex_widget.DisplayItem)
        self.item_widget.ItemUpdated.connect(self.table_model.Update)

        property_tab = QTabWidget()
        property_tab.setDocumentMode(True)
        property_tab.addTab(self.item_widget, "Edit")
        property_tab.addTab(self.bibtex_widget, "BibTeX")

        self.setHandleWidth(4)
        self.addWidget(self.table_view)
        self.addWidget(property_tab)
        self.setStretchFactor(0, 5)
        self.setStretchFactor(1, 2)
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
예제 #5
0
파일: main.py 프로젝트: cmaureir/deita
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        hlayout = QHBoxLayout()

        ##################################################### Left
        self.menu_level = 0
        self.item_list = QListWidget()
        self.fill_main_item_list()
        #self.item_list.setMinimumWidth(256)
        self.item_list.setMaximumWidth(300)
        self.item_list.setSizePolicy(QSizePolicy.Expanding,
                                     QSizePolicy.Expanding)
        self.item_list.setSizePolicy(QSizePolicy.Preferred,
                                     QSizePolicy.Preferred)
        self.item_list.itemClicked[QListWidgetItem].connect(self.item_clicked)

        ##################################################### Right
        b = QTabWidget()
        b.addTab(QWidget(), "Primera")
        b.addTab(QWidget(), "Segunda")
        b.setMinimumWidth(768)
        #b.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        b.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)

        hlayout.addWidget(self.item_list)
        hlayout.addWidget(b)
        self.setLayout(hlayout)
예제 #6
0
    def _layout(self):
        tab = QTabWidget(self)
        tab.addTab(ApplicationPage(self.host, parent=self), "Applications")
        tab.addTab(InterfacePage(self.host, parent=self), "Interface")

        self.setCentralWidget(tab)
        self.setContentsMargins(11, 11, 11, 11)
예제 #7
0
    def __inti_tab_widget__(self, widgets: list) -> object:
        tabs_widget = QTabWidget()
        tabs_widget.setTabPosition(QTabWidget.South)
        tabs_widget.setMinimumWidth(50)
        for wdg in widgets:
            tabs_widget.addTab(wdg, wdg.tab_name)

        return tabs_widget
class MainWindow(QtWidgets.QMainWindow):

    def updated(self, data, values):
        print("-> {} {}".format(data, values))

    def __init__(self, *args, **kwargs):
        super(MainWindow, self).__init__(*args, **kwargs)

        self.calibrations = QTabWidget(self)

        palette = self.calibrations.palette()
        back_color = palette.color(self.calibrations.backgroundRole())

        print('groupbox back_color {}'.format(
            back_color.name()))

        # back_color = self.calibrations.backgroundRole()

        # back_color = self.calibrations.backgroundRole())

        if (Application.Application.tabColor is not None):
            back_color = Application.Application.tabColor
        else:
            back_color = self.calibrations.palette().color(QtGui.QPalette.Base)
        text_color = self.calibrations.palette().color(QtGui.QPalette.WindowText)
        line_color = Application.Application.getAccentColor()

        print('groupbox tab_color Base {}'.format(
            self.calibrations.palette().color(QtGui.QPalette.Base).name()))
        print('groupbox tab_color AlternateBase {}'.format(
            self.calibrations.palette().color(QtGui.QPalette.AlternateBase).name()))
        print('groupbox tab_color Midlight {}'.format(
            self.calibrations.palette().color(QtGui.QPalette.Midlight).name()))
        print('groupbox tab_color button {}'.format(
            self.calibrations.palette().color(QtGui.QPalette.Button).name()))
        print('groupbox tab_color {}'.format(
            self.calibrations.palette().color(QtGui.QPalette.Base).name()))
        print('groupbox back_color {}'.format(
            back_color.name()))

        print('groupbox text_color {}'.format(
            text_color.name()))
        print('groupbox line_color {}'.format(
            line_color.name()))

        groupbox = None
        self.graphWidget = CalibrationWidget(self.calibrations, [[0, 0], [
                                             100, 100]], self.updated, [1, "test"], back_color, text_color, line_color)
        # self.graphWidget = CalibrationWidget(
        #     self.calibrations, [[0, 0], [100, 100]], self.updated, [1, "test"], back_color, text_color, line_color)

        self.calibrations.addTab(
            self.graphWidget, "graph")

        print('calibrations stylesheet {}'.format(
            self.calibrations.styleSheet()))

        self.setCentralWidget(self.calibrations)
예제 #9
0
    def initUI(self):
        qtab = QTabWidget()
        qtab.addTab(Tab1Widget(parent=self), 'Tab1')
        qtab.addTab(QLabel('Label 2'), 'Tab2')

        hbox = QHBoxLayout()
        hbox.addWidget(qtab)

        self.setLayout(hbox)
예제 #10
0
class MainWindow(QMainWindow):
    def __init__(self, widget, project_manager):
        QMainWindow.__init__(self)
        self.setWindowTitle("Project Manager")
        self.pm = project_manager

        # Menu
        self.menu = self.menuBar()
        self.file_menu = self.menu.addMenu("File")

        # Exit QAction
        exit_action = QAction("Exit", self)
        exit_action.setShortcut("Ctrl+Q")
        exit_action.triggered.connect(self.exit_app)
        self.file_menu.addAction(exit_action)

        # Layout
        layout2 = QVBoxLayout()
        self.project_tabs = QTabWidget()
        self.project_tabs.connect(self.project_tabs,
                                  SIGNAL('currentChanged(int)'),
                                  self.changed_tab)

        self.active_project_list = ActiveProjectList(project_manager, True)
        self.achived_project_list = ArchivedProjectList(project_manager, False)
        self.project_tabs.addTab(self.active_project_list, "Active projects")
        self.project_tabs.addTab(self.achived_project_list, "Archived")
        layout2.addWidget(self.project_tabs)
        layout2.addWidget(
            ButtonWidget(project_manager, self.active_project_list))

        self.layout = QHBoxLayout()
        self.layout.addWidget(StreamDeckLayout())
        self.layout.addItem(layout2)

        self.timer = QTimer()
        self.timer.timeout.connect(project_manager.poll)
        self.timer.start(200)

        widget.setLayout(self.layout)
        self.setCentralWidget(widget)

    def closeEvent(self, event):
        self.timer.stop()
        self.pm.exit()
        event.accept()

    @Slot()
    def exit_app(self, checked):
        QApplication.quit()

    def changed_tab(self, tab_index):
        if tab_index == 0:
            self.active_project_list.list.fill_list(True)
        elif tab_index == 1:
            self.achived_project_list.list.fill_list(False)
예제 #11
0
    def _central_widget(self) -> QTabWidget:
        tabs = QTabWidget()

        self._file_tab = FileTab(self.global_state)
        tabs.addTab(self._file_tab, self._file_tab.title)

        self._gallery_tab = GalleryTab(self.global_state)
        tabs.addTab(self._gallery_tab, self._gallery_tab.title)

        return tabs
예제 #12
0
class MainWindow(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)
        self.set_style()
        self.setWindowTitle("PDF Processor")
        self.installEventFilter(self)
        layout = QVBoxLayout()
        central_widget = QWidget()
        central_widget.setLayout(layout)
        self.status_bar = self.statusBar()
        self.tab_widget = QTabWidget()
        self.tab_imageToPdf = ImageToPdfWidget(self.status_bar)
        self.tab_extractPdf = SynthPdfWidget(self.status_bar)
        self.tab_widget.addTab(self.tab_imageToPdf, "Image To Pdf")
        self.tab_widget.addTab(self.tab_extractPdf, "Synth Pdf")

        layout.addWidget(self.tab_widget)
        create_widget = CreatePdfWidget(self.get_data, self.status_bar)
        layout.addWidget(create_widget)

        self.setCentralWidget(central_widget)
        self.resize(1280, 720)

    def eventFilter(self, source, event):
        if event.type() == QEvent.MouseButtonPress:
            self.status_bar.showMessage("")
        return QMainWindow.eventFilter(self, source, event)

    def set_style(self):
        appQt.setStyle("Fusion")
        palette = QPalette()
        palette.setColor(QPalette.Window, QColor(53, 53, 53))
        palette.setColor(QPalette.WindowText, Qt.white)
        palette.setColor(QPalette.Base, QColor(25, 25, 25))
        palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
        palette.setColor(QPalette.ToolTipBase, Qt.white)
        palette.setColor(QPalette.ToolTipText, Qt.white)
        palette.setColor(QPalette.Text, Qt.white)
        palette.setColor(QPalette.Button, QColor(53, 53, 53))
        palette.setColor(QPalette.ButtonText, Qt.white)
        palette.setColor(QPalette.BrightText, Qt.red)
        palette.setColor(QPalette.Link, QColor(235, 101, 54))
        palette.setColor(QPalette.Highlight, QColor(235, 101, 54))
        palette.setColor(QPalette.HighlightedText, Qt.black)
        appQt.setPalette(palette)

    def get_data(self):
        tab_index = self.tab_widget.currentIndex()
        if tab_index == 0:  # this is img->pdf
            return (0, self.tab_imageToPdf.get_images_to_save(),
                    self.tab_imageToPdf.get_image_parameters())
        elif tab_index == 1:  # this is synth pdf
            return (1, self.tab_extractPdf.extern_get_files_and_pages())
예제 #13
0
class _ControlTab(QWidget):
    """Tab which allows the user to control individual bots.

    Handles any events fired by the table etc.
    """

    def __init__(self, model):
        super(_ControlTab, self).__init__()

        self._model = model

        layout = QGridLayout()
        splitter = QSplitter()

        self._bot_table = _BotTable()
        self._responses_tab = _ResponsesTab()
        self._execute_tab = _ExecuteTab(self._responses_tab, model)

        self._tab_widget = QTabWidget()
        self._tab_widget.addTab(self._execute_tab, "Execute")
        self._tab_widget.addTab(self._responses_tab, "Responses")

        splitter.setOrientation(Qt.Vertical)
        splitter.addWidget(self._bot_table)
        splitter.addWidget(self._tab_widget)
        splitter.setSizes([50, 100])

        layout.addWidget(splitter)
        self.setLayout(layout)

        self._register_listeners()

    def _register_listeners(self):
        self._bot_table.set_on_selection_changed(self.on_table_selection_changed)

    def on_table_selection_changed(self):
        bot_uid = self._bot_table.item(self._bot_table.currentRow(), 0).text()

        self._execute_tab.set_current_bot(self._model.get_bot(bot_uid))
        self._execute_tab.set_module_layout()
        self._responses_tab.clear()

    def get_table(self):
        """
        :rtype: _BotTable
        """
        return self._bot_table

    def get_responses_tab(self):
        """
        :rtype: _ResponsesTab
        """
        return self._responses_tab
예제 #14
0
class SettingsDialog(QDialog):
    def __init__(self):
        super().__init__(GlobalAccess().get_main_window())
        self.widgets = [
            (MainTab(self), _('Main settings')),
            (SoundTab(self), _('Sounds')),
            (MultidayTab(self), _('Multi day')),
        ]

    def exec_(self):
        self.init_ui()
        return super().exec_()

    def init_ui(self):
        self.setWindowTitle(_('Settings'))
        self.setWindowIcon(QIcon(config.ICON))
        self.setSizeGripEnabled(False)
        self.setModal(True)

        self.tab_widget = QTabWidget()

        for tab, title in self.widgets:
            self.tab_widget.addTab(tab.widget, title)

        self.layout = QFormLayout(self)
        self.layout.addRow(self.tab_widget)

        def cancel_changes():
            self.close()

        def apply_changes():
            try:
                self.apply_changes_impl()
            except Exception as e:
                logging.exception(e)
            self.close()

        button_box = QDialogButtonBox(QDialogButtonBox.Ok
                                      | QDialogButtonBox.Cancel)
        self.button_ok = button_box.button(QDialogButtonBox.Ok)
        self.button_ok.setText(_('OK'))
        self.button_ok.clicked.connect(apply_changes)
        self.button_cancel = button_box.button(QDialogButtonBox.Cancel)
        self.button_cancel.setText(_('Cancel'))
        self.button_cancel.clicked.connect(cancel_changes)
        self.layout.addRow(button_box)

        self.show()

    def apply_changes_impl(self):
        for tab, _ in self.widgets:
            tab.save()
        Config().save()
예제 #15
0
class Table(QWidget):
    def __init__(self):
        super().__init__()

        self.mainLayout = QVBoxLayout()
        self.tabs = QTabWidget()
        self.mainLayout.addWidget(QLabel("Distribution:"))
        self.mainLayout.addWidget(self.tabs)

        self.tabs.addTab(UniformGraph(), "Uniform")
        self.tabs.addTab(GaussGraph(), "Gauss")
        self.setLayout(self.mainLayout)
예제 #16
0
    def __init__(self):
        super().__init__()

        self.setWindowTitle("My App")

        tabs = QTabWidget()
        tabs.setTabPosition(QTabWidget.West)
        tabs.setMovable(True)

        for n, color in enumerate(["red", "green", "blue", "yellow"]):
            tabs.addTab(Color(color), color)

        self.setCentralWidget(tabs)
예제 #17
0
파일: gui.py 프로젝트: ptrbortolotti/WEIS
    def recursion_ui_setup(self, dict_or_list: Union[List[Any], Dict[str, Any]]) -> QFormLayout:
        """
        This recursive method is where the automatic layout magic happens.
        This method calls itself recursively as it descends down the dictionary
        nesting structure.

        Basically, any given dictionary can consist of scalar and dictionary
        values. At each level of the dictionary, edit fields are placed for
        scalar values and tabbed widgets are placed for the next level of
        nesting.

        Parameters
        ----------
        dict_or_list: Dict[str, Any]
            The dictionary to automatically lay out in to the interface.
        """
        form_level_layout = QFormLayout()
        dict_tabs = QTabWidget()
        display_tabs = False
        subscripts_values = dict_or_list.items() if type(dict_or_list) is dict else enumerate(dict_or_list)  # type: ignore
        for k, v in subscripts_values:

            # Recursive call for nested dictionaries within dictionaries.
            if type(v) is dict:
                display_tabs = True
                child_widget = QWidget()
                child_layout = self.recursion_ui_setup(v)
                child_widget.setLayout(child_layout)
                dict_tabs.addTab(child_widget, str(k))

            # Recursive call for nested dictionaries within lists.
            elif type(v) is list and type(v[0]) is dict:
                display_tabs = True
                child_widget = QWidget()
                child_layout = self.recursion_ui_setup(v)
                child_widget.setLayout(child_layout)
                dict_tabs.addTab(child_widget, str(k))

            # Otherwise just lay out a label and text field.
            else:
                line_edit = FocusQLineEdit(str(v))
                line_edit.setMinimumWidth(150)
                line_edit.set_dictionary_and_key(dict_or_list, k)
                form_level_layout.addRow(QLabel(k), line_edit)

        # If there is a nested dictionary, display it.
        if display_tabs:
            form_level_layout.addRow(dict_tabs)

        # Return the whole layout
        return form_level_layout
예제 #18
0
    def __init__(self):
        super().__init__()

        widget = QTabWidget()
        widget.setTabPosition(QTabWidget.North)

        for label in ["red", "green", "blue", "yellow"]:
            widget.addTab(Color(label), label)

        widget.setMovable(True)
        widget.setTabsClosable(True)
        widget.tabCloseRequested.connect(widget.removeTab)

        self.setCentralWidget(widget)
예제 #19
0
class MainWidget(QWidget):
    def __init__(self):
        super().__init__()
        self.layout = QVBoxLayout()

        self.tabs = QTabWidget()
        self.tab1 = PlayersWidget()
        self.tab2 = TeamsWidget()

        self.tabs.addTab(self.tab1, "Players")
        self.tabs.addTab(self.tab2, "Teams")

        self.layout.addWidget(self.tabs)
        self.setLayout(self.layout)
예제 #20
0
class Piasa(QMainWindow):

    __instance = None
    __qt_app = QApplication(sys.argv)

    def __init__(self):
        if Piasa.__instance:
            raise Exception("Piasa application already exists")
        else:
            QMainWindow.__init__(self)
            self.resize(635, 800)
            self.setWindowTitle("Piasa Producers Calculator")
            self.tab_pane = QTabWidget()
            self.setCentralWidget(self.tab_pane)
            self.time_calculator = TimeCalculator()
            self.beat_calculator = BeatCalculator()
            self.tune_calculator = TuneCalculator()
            self.transposer = Transposer()
            self.scale_calculator = ScaleCalculator()
            self.chord_calculator = ChordCalculator()
            self.tab_pane.addTab(self.chord_calculator.form, "Chords")
            self.tab_pane.addTab(self.scale_calculator.form, "Scale")
            self.tab_pane.addTab(self.beat_calculator.form, "Beat")
            self.tab_pane.addTab(self.transposer.form, "Transpose")
            self.tab_pane.addTab(self.tune_calculator.form, "Tune")
            self.tab_pane.addTab(self.time_calculator.form, "Time")
            self.beat_calculator.update_ui()
            self.show()
            sys.exit(Piasa.__qt_app.exec_())
예제 #21
0
    def __init__(self, parent, icon_path):
        QDialog.__init__(self, parent)
        self.setModal(True)
        self.setWindowTitle(
            QCoreApplication.translate('icon-picker', 'Icon picker', 'title'))
        self.setFixedWidth(75 * 8 + 44)

        if not os.path.exists(icon_path) or not os.path.isdir(icon_path):
            os.mkdir(icon_path)
            if not os.path.exists(icon_path) or not os.path.isdir(icon_path):
                raise IOError('Icon folder not available')

        self._icon_path = icon_path

        self._icon_pick_tab_user = iconPickTab.IconPickTab(self, icon_path)
        self._icon_pick_tab_built_in = iconPickTab.IconPickTab(
            self, os.path.join(os.getcwd(), 'resources', 'icons'), False)
        self._icon_editor_tab = iconEditor.IconEditor(self)
        self._import_tab = importTab.ImportTab(self)

        layout = QVBoxLayout()
        tabs = QTabWidget(self)
        tabs.addTab(self._icon_pick_tab_user, 'Icon picker')
        tabs.addTab(self._icon_pick_tab_built_in, 'Built in icons')
        tabs.addTab(self._icon_editor_tab, 'Icon editor')
        tabs.addTab(self._import_tab, 'Import tab')

        layout.addWidget(tabs)
        self.setLayout(layout)
예제 #22
0
파일: prefs.py 프로젝트: mattdoiron/idfplus
    def __init__(self, parent, prefs):
        """Initialize the preferences tab
        """

        super(PrefsDialog, self).__init__(parent)
        self.prefs = prefs
        button_box = QDialogButtonBox(QDialogButtonBox.Ok)

        # Create the tab widget and assign its tabs
        tab_widget = QTabWidget()
        tab_widget.addTab(AppearanceTab(self), "Appearance")
        tab_widget.addTab(FontsTab(self, parent), "Fonts")
        tab_widget.addTab(SaveTab(self), "Save Options")
        tab_widget.addTab(AdvancedTab(self, parent), "Advanced")

        # Create layout and assign it to self
        layout = QVBoxLayout()
        layout.addWidget(tab_widget)
        layout.addWidget(button_box)
        self.resize(350, 350)
        self.setLayout(layout)
        self.setWindowTitle("IDF+ Options")

        # Connect gui elements to events
        button_box.accepted.connect(self.accept)
예제 #23
0
class MainWindow(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)
        settings = QSettings('dreamix Studio', 'rt-stats')
        self.setWindowTitle("RuTracker.org")
        self.setGeometry(200, 200, 640, 480)
        self.tabs = QTabWidget()

        self.rss = RssTab()
        self.rss.splitter.restoreState(settings.value('main/rss/splitter'))
        self.tabs.addTab(self.rss, "rss")

        self.twidget = TorrentsTab()
        self.twidget.splitter.restoreState(settings.value('main/new/splitter'))
        self.twidget.list.header().restoreState(
            settings.value('main/new/tree'))
        self.tabs.addTab(self.twidget, "new torrents")

        self.t2widget = Torrents2Tab()
        self.t2widget.splitter.restoreState(
            settings.value('main/update/splitter'))
        self.tabs.addTab(self.t2widget, "check torrents")

        self.user_tab = UserTab()
        self.tabs.addTab(self.user_tab, "users")

        self.web_tab = WebClientTab()
        self.tabs.addTab(self.web_tab, self.web_tab.title)
        self.setCentralWidget(self.tabs)

        self.ds = DataSource()
        self.resize(settings.value('main/size', QSize(640, 480)))
        self.move(settings.value('main/pos', QPoint(200, 200)))

    def closeEvent(self, event):
        self.rss.finish()
        self.twidget.finish()
        self.t2widget.finish()
        settings = QSettings('dreamix Studio', 'rt-stats')
        settings.setValue('main/size', self.size())
        settings.setValue('main/pos', self.pos())
        settings.setValue('main/rss/splitter', self.rss.splitter.saveState())
        settings.setValue('main/new/splitter',
                          self.twidget.splitter.saveState())
        settings.setValue('main/new/tree',
                          self.twidget.list.header().saveState())
        settings.setValue('main/update/splitter',
                          self.t2widget.splitter.saveState())
        event.accept()
예제 #24
0
파일: window.py 프로젝트: alek9z/dataMole
    def __init__(self, parent=None):
        super().__init__(parent)
        self.workbenchModel = WorkbenchModel(self)
        self.graph = flow.dag.OperationDag()
        self.operationMenu = OperationMenu()
        self.frameInfoPanel = FramePanel(parent=self,
                                         w=self.workbenchModel,
                                         opModel=self.operationMenu.model())
        self.workbenchView = WorkbenchView()
        self.workbenchView.setModel(self.workbenchModel)
        self.workbenchModel.emptyRowInserted.connect(
            self.workbenchView.startEditNoSelection)

        tabs = QTabWidget(self)

        attributeTab = AttributePanel(self.workbenchModel, self)
        chartsTab = ViewPanel(self.workbenchModel, self)
        self.graphScene = GraphScene(self)
        self._flowView = GraphView(self.graphScene, self)
        self.controller = GraphController(self.graph, self.graphScene,
                                          self._flowView, self.workbenchModel,
                                          self)

        tabs.addTab(attributeTab, '&Attribute')
        tabs.addTab(chartsTab, '&Visualise')
        tabs.addTab(self._flowView, 'F&low')
        self.__curr_tab = tabs.currentIndex()

        self.__leftSide = QSplitter(Qt.Vertical)
        self.__leftSide.addWidget(self.frameInfoPanel)
        self.__leftSide.addWidget(self.workbenchView)

        # layout = QHBoxLayout()
        # layout.addWidget(leftSplit, 2)
        # layout.addWidget(tabs, 8)
        splitter = QSplitter(Qt.Horizontal, self)
        splitter.addWidget(self.__leftSide)
        splitter.addWidget(tabs)
        layout = QHBoxLayout(self)
        layout.addWidget(splitter)

        tabs.currentChanged.connect(self.changeTabsContext)
        self.workbenchView.selectedRowChanged[str, str].connect(
            attributeTab.onFrameSelectionChanged)
        self.workbenchView.selectedRowChanged[str, str].connect(
            chartsTab.onFrameSelectionChanged)
        self.workbenchView.selectedRowChanged[str, str].connect(
            self.frameInfoPanel.onFrameSelectionChanged)
        self.workbenchView.rightClick.connect(self.createWorkbenchPopupMenu)
예제 #25
0
    def __init__(self):
        super().__init__()
        self.setWindowTitle("Tabs")

        tabs = QTabWidget()
        tabs.setTabPosition(QTabWidget.West)
        tabs.setMovable(True)
        # Only useful in macOS. It gives a more "common" feel for tabs,
        # since by default it uses a "pill" style tab button
        tabs.setDocumentMode(True)

        for color in ["red", "green", "blue", "yellow"]:
            tabs.addTab(Color(color), color)

        self.setCentralWidget(tabs)
예제 #26
0
파일: __main__.py 프로젝트: Mtrqq/exam-tapp
def run():
    app = QApplication(sys.argv)
    app.setApplicationDisplayName("Triangle calculator app")
    app.setApplicationName("ExamApp")
    apply_stylesheet(app, theme="dark_amber.xml")

    widget = QTabWidget()
    triangle_tab = TriangleAreaCalculator(widget)
    segment_tab = SegmentLengthCalculator(widget)
    widget.addTab(triangle_tab, "Triangle")
    widget.addTab(segment_tab, "Segment")

    widget.resize(800, 600)
    widget.show()

    sys.exit(app.exec_())
예제 #27
0
class TabWidgetClear(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)
        self.tabWidget = QTabWidget(self)
        self.setCentralWidget(self.tabWidget)
        self.editBox = QTextEdit(self)
        self.tabWidget.addTab(self.getSplitter(), 'Test')

    def getSplitter(self):
        splitter = QSplitter()
        splitter.addWidget(self.editBox)
        return splitter

    def toggle(self):
        self.tabWidget.clear()
        self.getSplitter()
예제 #28
0
class DefaultsDialog(QWidget):
    def __init__(self, kind, component, parent=None):
        super().__init__()
        self.clipboard = parent.clipboard
        self.setWindowTitle("%s : %s" % (kind, component))
        self.setGeometry(0, 0, 500, 500)
        # noinspection PyArgumentList
        self.move(QApplication.desktop().screenGeometry().center() -
                  self.rect().center())
        self.show()
        # Main layout
        self.layout = QVBoxLayout()
        self.setLayout(self.layout)
        self.display_tabs = QTabWidget()
        self.display = {}
        for k in ["yaml", "python", "bibliography"]:
            self.display[k] = QTextEdit()
            self.display[k].setLineWrapMode(QTextEdit.NoWrap)
            self.display[k].setFontFamily("mono")
            self.display[k].setCursorWidth(0)
            self.display[k].setReadOnly(True)
            self.display_tabs.addTab(self.display[k], k)
        self.layout.addWidget(self.display_tabs)
        # Fill text
        defaults_txt = get_default_info(component, kind, return_yaml=True)
        _indent = "  "
        defaults_txt = (kind + ":\n" + _indent + component + ":\n" +
                        2 * _indent +
                        ("\n" + 2 * _indent).join(defaults_txt.split("\n")))
        from cobaya.yaml import yaml_load
        self.display["python"].setText(pformat(yaml_load(defaults_txt)))
        self.display["yaml"].setText(defaults_txt)
        self.display["bibliography"].setText(get_bib_component(
            component, kind))
        # Buttons
        self.buttons = QHBoxLayout()
        self.close_button = QPushButton('Close', self)
        self.copy_button = QPushButton('Copy to clipboard', self)
        self.buttons.addWidget(self.close_button)
        self.buttons.addWidget(self.copy_button)
        self.close_button.released.connect(self.close)
        self.copy_button.released.connect(self.copy_clipb)
        self.layout.addLayout(self.buttons)

    @Slot()
    def copy_clipb(self):
        self.clipboard.setText(self.display_tabs.currentWidget().toPlainText())
예제 #29
0
 def __init__(self, parent=None):
     super(Form, self).__init__(parent)
     # Create widgets
     tabs = QTabWidget()
     master = MasterTab()
     tabs.addTab(master, 'master')
     self.edit = QLineEdit("Write my name here")
     self.button = QPushButton("Show Greetings")
     # Create layout and add widgets
     layout = QVBoxLayout()
     layout.addWidget(self.edit)
     layout.addWidget(self.button)
     layout.addWidget(tabs)
     # Set dialog layout
     self.setLayout(layout)
     # Add button signal to greetings slot
     self.button.clicked.connect(self.greetings)
예제 #30
0
class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        self.initUI()

    def initUI(self):

        # 创建tabwidget
        self.tabWidget = QTabWidget()
        # self.tabWidget.setTabShape(QTabWidget.Triangular)
        # self.tabWidget.setDocumentMode(True)
        # self.tabWidget.setMovable(True)
        self.tabWidget.setTabsClosable(True)
        self.tabWidget.tabCloseRequested.connect(self.closeTab)
        self.setCentralWidget(self.tabWidget)  # 也又指向self的作用

        self.brower = WebEngineView(
            self)  # 必须有self(指向不明不可用layout指定parent), 实际传入self.brower, self
        self.brower.load(QUrl("http://www.baidu.com"))
        self.createTab(self.brower)

        # self.setWindowFlags(Qt.FramelessWindowHint)
        self.setGeometry(300, 300, 600, 400)
        self.showMaximized()
        self.setWindowTitle("My Brower")
        # self.show()

    def createTab(self, brower):

        # 将widget变为标签页的形式
        self.tab = QWidget()
        self.tabWidget.addTab(self.tab, "新标签页")
        self.tabWidget.setCurrentWidget(self.tab)  # 设置为当前标签呀

        self.tab_layout = QHBoxLayout(self.tab)
        # self.tab_layout.setContentsMargins(0, 0, 0, 0)
        self.tab_layout.addWidget(brower)
        # brower无指向, 长在tab上, tab又add到tabWidget,

    def closeTab(self, index):

        if self.tabWidget.count() > 1:
            self.tabWidget.removeTab(index)
        else:
            self.close()
예제 #31
0
class MainWindow(QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()

        self.cameraInfo = QCameraInfo.defaultCamera()
        self.camera = QCamera(self.cameraInfo)
        self.camera.setCaptureMode(QCamera.CaptureStillImage)
        self.imageCapture = QCameraImageCapture(self.camera)
        self.imageCapture.imageCaptured.connect(self.imageCaptured)
        self.imageCapture.imageSaved.connect(self.imageSaved)
        self.currentPreview = QImage()

        toolBar = QToolBar()
        self.addToolBar(toolBar)

        fileMenu = self.menuBar().addMenu("&File")
        shutterIcon = QIcon(os.path.join(os.path.dirname(__file__),
                            "shutter.svg"))
        self.takePictureAction = QAction(shutterIcon, "&Take Picture", self,
                                         shortcut="Ctrl+T",
                                         triggered=self.takePicture)
        self.takePictureAction.setToolTip("Take Picture")
        fileMenu.addAction(self.takePictureAction)
        toolBar.addAction(self.takePictureAction)

        exitAction = QAction(QIcon.fromTheme("application-exit"), "E&xit",
                             self, shortcut="Ctrl+Q", triggered=self.close)
        fileMenu.addAction(exitAction)

        aboutMenu = self.menuBar().addMenu("&About")
        aboutQtAction = QAction("About &Qt", self, triggered=qApp.aboutQt)
        aboutMenu.addAction(aboutQtAction)

        self.tabWidget = QTabWidget()
        self.setCentralWidget(self.tabWidget)

        self.cameraViewfinder = QCameraViewfinder()
        self.camera.setViewfinder(self.cameraViewfinder)
        self.tabWidget.addTab(self.cameraViewfinder, "Viewfinder")

        if self.camera.status() != QCamera.UnavailableStatus:
            name = self.cameraInfo.description()
            self.setWindowTitle("PySide2 Camera Example (" + name + ")")
            self.statusBar().showMessage("Starting: '" + name + "'", 5000)
            self.camera.start()
        else:
            self.setWindowTitle("PySide2 Camera Example")
            self.takePictureAction.setEnabled(False)
            self.statusBar().showMessage("Camera unavailable", 5000)

    def nextImageFileName(self):
        picturesLocation = QStandardPaths.writableLocation(QStandardPaths.PicturesLocation)
        dateString = QDate.currentDate().toString("yyyyMMdd")
        pattern = picturesLocation + "/pyside2_camera_" + dateString + "_{:03d}.jpg"
        n = 1
        while True:
            result = pattern.format(n)
            if not os.path.exists(result):
                return result
            n = n + 1
        return None

    def takePicture(self):
        self.currentPreview = QImage()
        self.camera.searchAndLock()
        self.imageCapture.capture(self.nextImageFileName())
        self.camera.unlock()

    def imageCaptured(self, id, previewImage):
        self.currentPreview = previewImage

    def imageSaved(self, id, fileName):
        index = self.tabWidget.count()
        imageView = ImageView(self.currentPreview, fileName)
        self.tabWidget.addTab(imageView, "Capture #{}".format(index))
        self.tabWidget.setCurrentIndex(index)