Beispiel #1
0
    def __init__(self):
        super().__init__()

        StylesheetLoader.RegisterWidget(self)
        self.setWindowIcon(QIcon("Images/UCIcon.png"))

        centralLayout = QVBoxLayout()
        centralWidget = QWidget()
        centralWidget.setLayout(centralLayout)
        self.setCentralWidget(centralWidget)

        self._tabWidget = QTabWidget()
        centralLayout.addWidget(self._tabWidget)

        menuBar = MenuBar()
        self.setMenuBar(menuBar)

        menuBar.saveProgram.connect(
            lambda: self._tabWidget.currentWidget().SaveProgram())
        menuBar.closeProgram.connect(
            lambda: self.RequestCloseTab(self._tabWidget.currentIndex()))

        self._tabWidget.tabCloseRequested.connect(self.RequestCloseTab)
        self._tabWidget.setTabsClosable(True)

        timer = QTimer(self)
        timer.timeout.connect(self.CheckPrograms)
        timer.start(30)
Beispiel #2
0
    def __init__(self):
        super().__init__()

        self.setWindowTitle("Widgets App")

        layout = QVBoxLayout()
        widgets = [
            QCheckBox,
            QComboBox,
            QDateEdit,
            QDateTimeEdit,
            QDial,
            QDoubleSpinBox,
            QFontComboBox,
            QLCDNumber,
            QLabel,
            QLineEdit,
            QProgressBar,
            QPushButton,
            QRadioButton,
            QSlider,
            QSpinBox,
            QTimeEdit,
        ]

        for w in widgets:
            layout.addWidget(w())

        widget = QWidget()
        widget.setLayout(layout)

        # Set the central widget of the Window. Widget will expand
        # to take up all the space in the window by default.
        self.setCentralWidget(widget)
class SongDetailsDialog(QDialog):
    def __init__(self, song: Song, parent, remove_callback=None):
        """Show a popup with a songs details
        :type song: Song
        :param song: The song whose details should be shown
        :type parent: QWidget
        :param parent: The parent widget
        :type remove_callback: (Song) -> None
        :param remove_callback: A function to call when the song should be removed"""
        super().__init__(parent)
        # Set parameters
        self._song = song
        self._parent = parent
        self._remove_callback = remove_callback
        # Set gui
        self.setWindowTitle(song.get_name())
        #self.setWindowModality(Qt.ApplicationModal)
        self.layout = QVBoxLayout(self)
        self.setLayout(self.layout)
        # Remove action
        if remove_callback is not None:
            remove_button = QPushButton("Remove", self)
            remove_button.clicked.connect(self._remove_button_clicked)
            self.layout.addWidget(remove_button)
        # Song text
        label = QLabel(song.get_text(), self)
        self.layout.addWidget(label)

    def _remove_button_clicked(self, a):
        """Handle that the remove button was clicked"""
        # Call the passed callback if any
        if self._remove_callback is not None:
            self.close()
            self.deleteLater()
            self._remove_callback()
Beispiel #4
0
    def __init__(self, valve: Valve):
        super().__init__()

        AppGlobals.Instance().onChipModified.connect(self.CheckForValve)

        self._valve = valve

        self.valveToggleButton = QToolButton()
        self.valveNumberLabel = QLabel("Number")
        self.valveNumberDial = QSpinBox()
        self.valveNumberDial.setMinimum(0)
        self.valveNumberDial.setValue(self._valve.solenoidNumber)
        self.valveNumberDial.setMaximum(9999)
        self.valveNumberDial.valueChanged.connect(self.UpdateValve)

        self.valveNameLabel = QLabel("Name")
        self.valveNameField = QLineEdit(self._valve.name)
        self.valveNameField.textChanged.connect(self.UpdateValve)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(self.valveToggleButton, alignment=Qt.AlignCenter)

        layout = QGridLayout()
        layout.addWidget(self.valveNameLabel, 0, 0)
        layout.addWidget(self.valveNameField, 0, 1)
        layout.addWidget(self.valveNumberLabel, 1, 0)
        layout.addWidget(self.valveNumberDial, 1, 1)

        mainLayout.addLayout(layout)
        self.containerWidget.setLayout(mainLayout)
        self.valveToggleButton.clicked.connect(self.Toggle)

        self.Update()
        self.Move(QPointF())
Beispiel #5
0
class RunTab(QWidget):
    def __init__(self, main_window):
        super().__init__()
        self.main_window = main_window

        self.layout = QVBoxLayout(self)

        self.validation_panel = ValidationPanel(self.main_window)
        self.layout.addLayout(self.validation_panel.layout)

        self.log_panel = LogPanel(self)
        self.layout.addWidget(self.log_panel.widget)

        self.run_button = QPushButton("Run", self)
        self.run_button.clicked.connect(self.run)
        self.layout.addWidget(self.run_button)

        self.main_window.running_changed.connect(
            lambda b: self.run_button.setEnabled(not b))

        self.thread = RunThread(
            lambda: self.main_window.running_changed.emit(True),
            lambda: self.main_window.running_changed.emit(False),
        )

    def run(self):
        self.validation_panel.clear()
        self.log_panel.clear()
        self.thread.start(
            self.main_window.config,
            self.log_panel,
            self.validation_panel,
        )
Beispiel #6
0
    def __init__(self, arg=None):
        super(Table, self).__init__(arg)
        # 设置窗体的标题和初始大小
        self.setWindowTitle("QTableView 表格视图控件的例子")
        self.resize(600, 300)

        # 准备数据模型,设置数据层次结构为6行5列
        self.model = QStandardItemModel(6, 5)
        # 设置数据栏名称
        self.model.setHorizontalHeaderLabels(['标题1', '标题2', '标题3', '标题4',  '标题5'])

        for row in range(6):
            for column in range(5):
                item = QStandardItem("行 %s, 列 %s" % (row, column ))
                self.model.setItem(row, column, item)

        # 实例化表格视图,设置模型为自定义的模型
        self.tableView = QTableView()
        self.tableView.setModel(self.model)

        ############ 下面代码让表格 100% 的填满窗口
        self.tableView.horizontalHeader().setStretchLastSection(True)
        self.tableView.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)

        # 局部布局
        vboxLayout = QVBoxLayout()
        vboxLayout.addWidget(self.tableView)
        # 全局布局
        wl = QVBoxLayout(self)
        wl.addLayout(vboxLayout)
Beispiel #7
0
    def __init__(self, persepolis_setting):
        super().__init__()
        icon = QIcon()

        self.persepolis_setting = persepolis_setting

        # add support for other languages
        locale = str(self.persepolis_setting.value('settings/locale'))
        QLocale.setDefault(QLocale(locale))
        self.translator = QTranslator()
        if self.translator.load(':/translations/locales/ui_' + locale, 'ts'):
            QCoreApplication.installTranslator(self.translator)

        self.setWindowIcon(
            QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg')))
        self.setWindowTitle(
            QCoreApplication.translate("setting_ui_tr", 'Preferences'))

        # set ui direction
        ui_direction = self.persepolis_setting.value('ui_direction')

        if ui_direction == 'rtl':
            self.setLayoutDirection(Qt.RightToLeft)

        elif ui_direction in 'ltr':
            self.setLayoutDirection(Qt.LeftToRight)

        global icons
        icons = ':/' + str(
            self.persepolis_setting.value('settings/icons')) + '/'

        window_verticalLayout = QVBoxLayout(self)

        self.pressKeyLabel = QLabel(self)
        window_verticalLayout.addWidget(self.pressKeyLabel)

        self.capturedKeyLabel = QLabel(self)
        window_verticalLayout.addWidget(self.capturedKeyLabel)

        # window buttons
        buttons_horizontalLayout = QHBoxLayout()
        buttons_horizontalLayout.addStretch(1)

        self.cancel_pushButton = QPushButton(self)
        self.cancel_pushButton.setIcon(QIcon(icons + 'remove'))
        buttons_horizontalLayout.addWidget(self.cancel_pushButton)

        self.ok_pushButton = QPushButton(self)
        self.ok_pushButton.setIcon(QIcon(icons + 'ok'))
        buttons_horizontalLayout.addWidget(self.ok_pushButton)

        window_verticalLayout.addLayout(buttons_horizontalLayout)

        # labels
        self.pressKeyLabel.setText(
            QCoreApplication.translate("setting_ui_tr", "Press new keys"))
        self.cancel_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", "Cancel"))
        self.ok_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", "OK"))
Beispiel #8
0
    def createSequencerControls(self):
        widget = QWidget()
        layout = QVBoxLayout()

        layout.addWidget(self.createSequencerSections(1))
        layout.addWidget(self.createSequencerSections(2))
        layout.addWidget(self.createRhythmSection())

        hbox = Qtw.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        hbox.addWidget(self.createTransportSection())
        hbox.addWidget(self.createEnvSection())
        hbox.setStretch(0, 1)
        hbox.setStretch(1, 1)

        layout.addLayout(hbox)

        layout.setContentsMargins(0, 0, 0, 0)
        widget.setContentsMargins(0, 0, 0, 0)
        layout.setStretch(0, 2)
        layout.setStretch(1, 2)
        layout.setStretch(2, 4)
        layout.setStretch(3, 2)

        widget.setLayout(layout)
        return widget
Beispiel #9
0
class MyWidget(QWidget):
    def __init__(self):
        super(MyWidget, self).__init__()
        self.init_gui()

    def init_gui(self):
        self.setWindowTitle("Reimplementing Events")
        self.setGeometry(300, 250, 300, 100)

        self.myLayout = QVBoxLayout()

        self.myLabel = QLabel("Press 'Esc' to close this App")
        self.infoLabel = QLabel()

        self.myLabel.setAlignment(Qt.AlignCenter)
        self.infoLabel.setAlignment(Qt.AlignCenter)

        self.myLayout.addWidget(self.myLabel)
        self.myLayout.addWidget(self.infoLabel)

        self.setLayout(self.myLayout)
        self.show()

    def keyPressEvent(self, event: PySide6.QtGui.QKeyEvent) -> None:
        if event.key() == Qt.Key_Escape:
            self.close()

    def mouseDoubleClickEvent(self, event: PySide6.QtGui.QMouseEvent) -> None:
        self.close()

    def resizeEvent(self, event: PySide6.QtGui.QResizeEvent) -> None:
        self.infoLabel.setText("Window Resized to QSize(%d, %d)" %
                               (event.size().width(), event.size().height()))
class NavigationDialog(QDialog):
    def __init__(self):
        super(NavigationDialog, self).__init__()
        self.resize(200, 200)

        # Label
        self.label = QLabel(self)
        self.label.setObjectName(u"label")
        self.label.setLineWidth(1)
        self.label.setTextFormat(Qt.RichText)

        # Buttons
        button = QDialogButtonBox.Ok
        self.buttonBox = QDialogButtonBox(button)
        self.buttonBox.accepted.connect(self.accept)

        # VBox for whole content
        self.verticalLayout = QVBoxLayout(self)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.addWidget(self.label)
        self.verticalLayout.addWidget(self.buttonBox)

        # Texts
        self.text_ui()

    def text_ui(self):
        self.setWindowTitle("Navigation")
        self.label.setText("Mousewheel - after clicking scene - zoom scene<br />"
                           "Mouse left click and release - draw shape<br />"
                           "Left and right arrows after shape selection - rotate<br />"
                           "WSAD after shape selection - scale shape<br / >"
                           "To change draw mode, click actions on toolbar<br />"
                           "To save and open, click 'File' action on menubar<br />")
Beispiel #11
0
    def __init__(self, data):
        global instance_id
        QWidget.__init__(self)
        self.actionHandler = UIActionHandler()
        self.actionHandler.setupActionHandler(self)
        offset_layout = QHBoxLayout()
        offset_layout.addWidget(QLabel("Offset: "))
        self.offset = QLabel(hex(0))
        offset_layout.addWidget(self.offset)
        offset_layout.setAlignment(QtCore.Qt.AlignCenter)
        datatype_layout = QHBoxLayout()
        datatype_layout.addWidget(QLabel("Data Type: "))
        self.datatype = QLabel("")
        datatype_layout.addWidget(self.datatype)
        datatype_layout.setAlignment(QtCore.Qt.AlignCenter)
        layout = QVBoxLayout()
        title = QLabel("Hello Pane", self)
        title.setAlignment(QtCore.Qt.AlignCenter)
        instance = QLabel("Instance: " + str(instance_id), self)
        instance.setAlignment(QtCore.Qt.AlignCenter)
        layout.addStretch()
        layout.addWidget(title)
        layout.addWidget(instance)
        layout.addLayout(datatype_layout)
        layout.addLayout(offset_layout)
        layout.addStretch()
        self.setLayout(layout)
        instance_id += 1
        self.data = data

        # Populate initial state
        self.updateState()

        # Set up view and address change notifications
        self.notifications = HelloNotifications(self)
class ModeBasedListView(QWidget):
    def __init__(self, clipboard):
        QWidget.__init__(self)
        self.layout = QVBoxLayout()
        self.layout.setSpacing(0)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.session_bar = SessionBar(clipboard)
        self.layout.addWidget(self.session_bar)

        self.list_view = ListItemView()
        self.layout.addWidget(self.list_view)

        self.setLayout(self.layout)

    def update(self, prefix, elapsed, fame, fame_per_hour,
               players: PlayerListItem):
        self.session_bar.player_stats.update(elapsed, fame, fame_per_hour)
        self.session_bar.copy_button.update(
            prefix, self.list_view.get_player_list_items(),
            self.session_bar.mode.get_mode(), fame)
        self.list_view.update(players)
        self.session_bar.update()

    def get_mode(self) -> str:
        return self.session_bar.mode.get_mode()
Beispiel #13
0
    def __init__(self, controller, parent=None):
        super().__init__("Timebase", parent=parent)
        self.controller = controller

        layout = QVBoxLayout()
        self.setLayout(layout)

        self.timebase_options = [
            "100 us",
            "200 us",
            "500 us",
            "1 ms",
            "2 ms",
            "5 ms",
            "10 ms",
            "20 ms",
        ]
        self.combobox_timebase = QComboBox()
        self.combobox_timebase.addItems(self.timebase_options)
        self.combobox_timebase.setCurrentIndex(7)

        layout.addWidget(QLabel("time/div (1 div = 1/10 graph)"))
        layout.addWidget(self.combobox_timebase)

        self.combobox_timebase.currentTextChanged.connect(self.set_timebase)
Beispiel #14
0
    def __init__(self, program: Program):
        super().__init__()
        self._program = program

        parametersLabel = QLabel("Parameters")
        newParameterButton = QPushButton("Add Parameter")
        newParameterButton.clicked.connect(self.AddParameter)

        layout = QVBoxLayout()
        titleLayout = QHBoxLayout()
        titleLayout.addWidget(parametersLabel)
        titleLayout.addWidget(newParameterButton)
        layout.addLayout(titleLayout)

        self._listArea = QScrollArea()
        self._listArea.setWidgetResizable(True)
        self._listArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self._listArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        layout.addWidget(self._listArea, stretch=1)
        listWidget = QWidget()
        self._itemLayout = QVBoxLayout()
        self._itemLayout.setAlignment(Qt.AlignTop)
        listWidget.setLayout(self._itemLayout)
        self.setLayout(layout)
        self._listArea.setWidget(listWidget)

        self.items: List[ParameterEditorItem] = []

        self._temporaryParameters = program.parameters.copy()

        self.Populate()
class UnsavedChangesDialog(QDialog):
    def __init__(self):
        super(UnsavedChangesDialog, self).__init__()
        self.resize(200, 125)

        # Label
        self.label = QLabel(self)
        self.label.setObjectName(u"label")
        self.label.setLineWidth(1)
        self.label.setTextFormat(Qt.RichText)

        # Buttons
        buttons = QDialogButtonBox.Ok | QDialogButtonBox.Cancel
        self.buttonBox = QDialogButtonBox(buttons)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)

        # VBox for whole content
        self.verticalLayout = QVBoxLayout(self)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.addWidget(self.label)
        self.verticalLayout.addWidget(self.buttonBox)

        # Texts
        self.text_ui()

    def text_ui(self):
        self.label.setText("<h2 align=\"center\" style=\" margin-top:18px; margin-bottom:12px; "
                           "margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"
                           "<span style=\" font-size:7pt; font-weight:700;\">Unsaved changes detected. "
                           "Continue?</span></h2>")
Beispiel #16
0
    def __init__(self):
        super(MainWindow, self).__init__()
        # 左边的菜单项
        menu_widget = QListWidget()
        for i in range(10):
            item = QListWidgetItem(f"item {i}")
            item.setTextAlignment(Qt.AlignCenter)
            menu_widget.addItem(item)
        _placeholder = "text_widget"

        text_widget = QLabel(_placeholder)
        button = QPushButton("Click")

        # 横向布局
        content_layout = QVBoxLayout()
        content_layout.addWidget(text_widget)
        content_layout.addWidget(button)

        main_widget = QWidget()
        main_widget.setLayout(content_layout)

        layout = QHBoxLayout()
        layout.addWidget(menu_widget, 1)
        layout.addWidget(main_widget, 4)

        self.setLayout(layout)
    def initUI(self):
        """
        Init widget

        """
        vbox = QVBoxLayout()
        vbox.addSpacing(2)

        # Head
        hbox = QHBoxLayout()
        hbox.addSpacing(2)

        # Create button which returns to the menu
        self._buttonBack = QPushButton(QIcon(PATH_IMAGE_BACK_NEDDLE), "", self)
        self._buttonBack.clicked.connect(self.signalController.back2menu)
        hbox.addWidget(self._buttonBack, 0, QtCore.Qt.AlignLeft)
        # Header of this widget
        self._headWidget = QLabel("About game")
        hbox.addWidget(self._headWidget, 1, QtCore.Qt.AlignCenter)

        vbox.addLayout(hbox, 0)

        # Create text about game
        text = ABOUT_GAME_STR
        self.textAboutGame = QLabel(text)
        self.textAboutGame.setWordWrap(True)
        self.setFont(QFont("Times", 12, QFont.Bold))
        vbox.addWidget(self.textAboutGame, 1, QtCore.Qt.AlignCenter)

        self.setLayout(vbox)
        self.setWindowTitle("About game")
Beispiel #18
0
class AboutDialog(QDialog):
    def __init__(self):
        super().__init__()
        self.main_layout = None
        self.setWindowTitle("关于")
        self.setWindowIcon(GMakeIcon(GRes.app_icon_ico))
        self.setFixedSize(320, 240)
        self.setup_ui()

    def setup_ui(self):
        self.main_layout = QVBoxLayout()
        self.main_layout.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft)
        self.setLayout(self.main_layout)

        name = '<a href="%s"><b><font size="4" color="#333">%s</font></b></a>' % (Globals.repo, Globals.app_name)
        version = '<b><font size="3" color="#333">版本:</font></b>%s' % Globals.version
        author = '<b><font size="3" color="#333">作者:</font></b>%s' % Globals.author
        tech = '<b><font size="3" color="#333">技术:</font></b>'
        name_lab = QLabel(name)
        name_lab.setOpenExternalLinks(True)
        self.main_layout.addWidget(name_lab)
        self.main_layout.addWidget(QLabel(version))
        self.main_layout.addWidget(QLabel(author))
        self.main_layout.addWidget(QLabel(tech))
        for t in Globals.tech.split('\n'):
            self.main_layout.addWidget(QLabel('<font color="#444">  %s</font>' % t))
    def __init__(self, parent=None):
        super(AddDialogWidget, self).__init__(parent)

        nameLabel = QLabel("Name")
        addressLabel = QLabel("Address")
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)

        self.nameText = QLineEdit()
        self.addressText = QTextEdit()

        grid = QGridLayout()
        grid.setColumnStretch(1, 2)
        grid.addWidget(nameLabel, 0, 0)
        grid.addWidget(self.nameText, 0, 1)
        grid.addWidget(addressLabel, 1, 0, Qt.AlignLeft | Qt.AlignTop)
        grid.addWidget(self.addressText, 1, 1, Qt.AlignLeft)

        layout = QVBoxLayout()
        layout.addLayout(grid)
        layout.addWidget(buttonBox)

        self.setLayout(layout)

        self.setWindowTitle("Add a Contact")

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
Beispiel #20
0
class EditIconWidget(TritonWidget):
    def __init__(self, base, name, callback, *args, **kwargs):
        TritonWidget.__init__(self, base, *args, **kwargs)
        self.callback = callback

        self.setWindowTitle(name)
        self.setBackgroundColor(self, Qt.white)

        self.boxLayout = QVBoxLayout(self)
        self.boxLayout.setContentsMargins(0, 5, 0, 0)
        layout = None

        for i, icon in enumerate(os.listdir('icons')):
            if (not layout) or i % 10 == 0:
                widget = QWidget()
                layout = QHBoxLayout(widget)
                layout.setContentsMargins(5, 5, 5, 5)
                self.boxLayout.addWidget(widget)

            name = os.path.join('icons', icon)
            button = PixmapButton(QPixmap(name).scaled(48, 48))
            button.clicked.connect(self.makeIconCallback(name))
            button.setToolTip(icon)
            layout.addWidget(button)

        self.setFixedSize(self.sizeHint())
        self.center()
        self.show()

    def makeIconCallback(self, name):
        def iconCallback():
            self.callback(name)
            self.close()

        return iconCallback
Beispiel #21
0
    def __init__(self, parent, start, stop):
        super().__init__(parent)
        self.setWindowTitle("Crop data")
        vbox = QVBoxLayout(self)
        grid = QGridLayout()
        self.start_checkbox = QCheckBox("Start time:")
        self.start_checkbox.setChecked(True)
        self.start_checkbox.stateChanged.connect(self.toggle_start)
        grid.addWidget(self.start_checkbox, 0, 0)
        self._start = QDoubleSpinBox()
        self._start.setMaximum(999999)
        self._start.setValue(start)
        self._start.setDecimals(2)
        self._start.setSuffix(" s")
        grid.addWidget(self._start, 0, 1)

        self.stop_checkbox = QCheckBox("Stop time:")
        self.stop_checkbox.setChecked(True)
        self.stop_checkbox.stateChanged.connect(self.toggle_stop)
        grid.addWidget(self.stop_checkbox, 1, 0)
        self._stop = QDoubleSpinBox()
        self._stop.setMaximum(999999)
        self._stop.setValue(stop)
        self._stop.setDecimals(2)
        self._stop.setSuffix(" s")
        grid.addWidget(self._stop, 1, 1)
        vbox.addLayout(grid)
        buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        vbox.addWidget(buttonbox)
        buttonbox.accepted.connect(self.accept)
        buttonbox.rejected.connect(self.reject)
        vbox.setSizeConstraint(QVBoxLayout.SetFixedSize)
	def __init__(self, name):
		global instance_id
		GlobalAreaWidget.__init__(self, name)
		self.actionHandler = UIActionHandler()
		self.actionHandler.setupActionHandler(self)
		offset_layout = QHBoxLayout()
		offset_layout.addWidget(QLabel("Offset: "))
		self.offset = QLabel(hex(0))
		offset_layout.addWidget(self.offset)
		offset_layout.setAlignment(QtCore.Qt.AlignCenter)
		datatype_layout = QHBoxLayout()
		datatype_layout.addWidget(QLabel("Data Type: "))
		self.datatype = QLabel("")
		datatype_layout.addWidget(self.datatype)
		datatype_layout.setAlignment(QtCore.Qt.AlignCenter)
		layout = QVBoxLayout()
		title = QLabel(name, self)
		title.setAlignment(QtCore.Qt.AlignCenter)
		instance = QLabel("Instance: " + str(instance_id), self)
		instance.setAlignment(QtCore.Qt.AlignCenter)
		layout.addStretch()
		layout.addWidget(title)
		layout.addWidget(instance)
		layout.addLayout(datatype_layout)
		layout.addLayout(offset_layout)
		layout.addStretch()
		self.setLayout(layout)
		instance_id += 1
		self.data = None
Beispiel #23
0
class ProgressExample(QWidget):
    """The main ui components"""
    def __init__(self, parent=None):
        super(ProgressExample, self).__init__(parent)
        self.setupUi()

    def setupUi(self):
        self.setWindowTitle('QProgressBar Example')
        self.btn = QPushButton('Click Me!')
        self.btn.clicked.connect(self.btnFunc)
        self.pBar = QProgressBar()
        self.pBar.setValue(0)
        self.resize(300, 100)
        self.vbox = QVBoxLayout()
        self.vbox.addWidget(self.pBar)
        self.vbox.addWidget(self.btn)
        self.setLayout(self.vbox)
        self.show()

    def btnFunc(self):
        self.thread = Thread()
        self.thread._signal.connect(self.signal_accept)
        self.thread.start()
        self.btn.setEnabled(False)

    def signal_accept(self, msg):
        self.pBar.setValue(int(msg))
        if self.pBar.value() == 99:
            self.pBar.setValue(0)
            self.btn.setEnabled(True)
Beispiel #24
0
    def __init__(self, parent, xml):
        super().__init__(parent)
        self.setWindowTitle("Information")

        tree = QTreeWidget()
        tree.setColumnCount(2)
        tree.setHeaderLabels(["Name", "Value"])
        tree.setColumnWidth(0, 200)
        tree.setColumnWidth(1, 350)

        for stream in xml:
            header = xml[stream][2]
            header.tag = "Header"
            footer = xml[stream][6]
            footer.tag = "Footer"

            root = ETree.Element(f"Stream {stream}")
            root.extend([header, footer])
            populate_tree(tree, root)

        tree.expandAll()

        vbox = QVBoxLayout(self)
        vbox.addWidget(tree)
        buttonbox = QDialogButtonBox(QDialogButtonBox.Ok)
        vbox.addWidget(buttonbox)
        buttonbox.accepted.connect(self.accept)

        self.resize(650, 550)
Beispiel #25
0
    def __init__(self, previewImage, fileName):
        super(ImageView, self).__init__()

        self.fileName = fileName

        mainLayout = QVBoxLayout(self)
        self.imageLabel = QLabel()
        self.imageLabel.setPixmap(QPixmap.fromImage(previewImage))
        mainLayout.addWidget(self.imageLabel)

        topLayout = QHBoxLayout()
        self.fileNameLabel = QLabel(QDir.toNativeSeparators(fileName))
        self.fileNameLabel.setTextInteractionFlags(Qt.TextBrowserInteraction)

        topLayout.addWidget(self.fileNameLabel)
        topLayout.addStretch()
        copyButton = QPushButton("Copy")
        copyButton.setToolTip("Copy file name to clipboard")
        topLayout.addWidget(copyButton)
        copyButton.clicked.connect(self.copy)
        launchButton = QPushButton("Launch")
        launchButton.setToolTip("Launch image viewer")
        topLayout.addWidget(launchButton)
        launchButton.clicked.connect(self.launch)
        mainLayout.addLayout(topLayout)
Beispiel #26
0
    def __init__(self, *args, **kwargs):
        super(FramelessWindow, self).__init__(*args, **kwargs)
        self._pressed = False
        self.Direction = None
        self.resize(760, 580)

        # Фон прозрачный
        self.setAttribute(Qt.WA_TranslucentBackground, True)

        # Нет границы
        self.setWindowFlag(Qt.FramelessWindowHint)
        # Отслеживание мыши
        self.setMouseTracking(True)

        # макет
        layout = QVBoxLayout(self)
        layout.setSpacing(0)
        # Зарезервировать границы для изменения размера окна без полей
        layout.setContentsMargins(self.Margins, self.Margins, self.Margins,
                                  self.Margins)
        # Панель заголовка
        self.titleBar = TitleBar(self)
        layout.addWidget(self.titleBar)

        # слот сигнала
        self.titleBar.windowMinimumed.connect(self.showMinimized)
        self.titleBar.windowMaximumed.connect(self.showMaximized)
        self.titleBar.windowNormaled.connect(self.showNormal)
        self.titleBar.windowClosed.connect(self.close)
        self.titleBar.windowMoved.connect(self.move)
        self.windowTitleChanged.connect(self.titleBar.setTitle)
        self.windowIconChanged.connect(self.titleBar.setIcon)
Beispiel #27
0
    def __init__(self, app: "MainWindow", parent=None):
        super(FormationExtrapolator, self).__init__(parent)
        self.app = app

        self.setWindowTitle(self.app.settings.WINDOW_TITLE)
        self.setWindowIcon(QIcon(self.app.settings.WINDOW_ICON))

        layout = QVBoxLayout()

        self.table = QTableWidget(10, 5)
        self.table.setMinimumWidth(500)
        self.table.setMinimumHeight(500)
        self.table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.table.setFocusPolicy(Qt.NoFocus)
        self.table.setSelectionMode(QAbstractItemView.NoSelection)
        self.table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.table.verticalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
        labels = ["Formation\nAccumulator", "Formation ID", "Enemies", "Enemy\nFormation", "Preemptable"]
        for i in range(len(labels)):
            self.table.setHorizontalHeaderItem(i, QTableWidgetItem(labels[i]))
            for j in range(self.table.rowCount()):
                self.table.setCellWidget(j, i, QLabel())
        for i in range(self.table.rowCount()):
            self.table.setVerticalHeaderItem(i, QTableWidgetItem(""))
        layout.addWidget(self.table)

        self.setLayout(layout)
        self.show()
Beispiel #28
0
    def initUI(self):

        self.cam = CamImage()
        self.start_button = QPushButton("Start")
        self.quit_button = QPushButton("Quit")
        controls = ControlWidget()
        self.combo = QComboBox(self)
        for it in self.MainProcess.list_of_filters:
            self.combo.addItem(it[0])

        hbox = QHBoxLayout()
        hbox.addWidget(controls)
        hbox.addStretch(1)
        hbuttons = QHBoxLayout()
        hbuttons.addWidget(self.combo)
        hbuttons.addWidget(self.start_button)
        hbuttons.addWidget(self.quit_button)
        vbutton = QVBoxLayout()
        vbutton.addLayout(hbuttons)
        vbutton.addWidget(self.fps_label)
        hbox.addLayout(vbutton)
        vbox = QVBoxLayout()
        vbox.addWidget(self.cam)
        vbox.addStretch(1)
        vbox.addLayout(hbox)

        self.setLayout(vbox)

        self.setGeometry(300, 300, 300, 150)
        self.setWindowTitle('Buttons')

        self.show()
Beispiel #29
0
 def __init__(self, parent, view, data):
     super(ExportsWidget, self).__init__(parent)
     layout = QVBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     self.imports = ExportsTreeView(self, view, data)
     self.filter = FilteredView(self, self.imports, self.imports)
     layout.addWidget(self.filter, 1)
     self.setLayout(layout)
     self.setMinimumSize(UIContext.getScaledWindowSize(100, 196))
Beispiel #30
0
 def __init__(self, parent, title, message):
     super().__init__(parent)
     self.setWindowTitle(title)
     vbox = QVBoxLayout(self)
     label = QLabel(message)
     button = QDialogButtonBox(QDialogButtonBox.Cancel)
     button.rejected.connect(self.close)
     vbox.addWidget(label)
     vbox.addWidget(button)