Beispiel #1
0
    def __init__(self, parent, name, data):
        QWidget.__init__(self, parent)
        DockContextHandler.__init__(self, self, name)
        self.actionHandler = UIActionHandler()
        self.actionHandler.setupActionHandler(self)

        status_layout = QHBoxLayout()
        status_layout.addWidget(QLabel('Status: '))
        self.status = QLabel('idle')
        status_layout.addWidget(self.status)
        status_layout.setAlignment(QtCore.Qt.AlignCenter)

        client_dbg_layout = QHBoxLayout()
        client_dbg_layout.addWidget(QLabel('Client debugger: '))
        self.client_dbg = QLabel('n/a')
        client_dbg_layout.addWidget(self.client_dbg)
        client_dbg_layout.setAlignment(QtCore.Qt.AlignCenter)

        client_pgm_layout = QHBoxLayout()
        client_pgm_layout.addWidget(QLabel('Client program: '))
        self.client_pgm = QLabel('n/a')
        client_pgm_layout.addWidget(self.client_pgm)
        client_pgm_layout.setAlignment(QtCore.Qt.AlignCenter)

        layout = QVBoxLayout()
        layout.addStretch()
        layout.addLayout(status_layout)
        layout.addLayout(client_dbg_layout)
        layout.addLayout(client_pgm_layout)
        layout.addStretch()
        self.setLayout(layout)
Beispiel #2
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 #3
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)
	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 #5
0
 def __init__(self):
     super().__init__()
     self.layout = QHBoxLayout()
     i = 0
     self.names = []
     self.ebutons = []
     self.dbutons = []
     folder = './saved'
     #-------------Loading saved images from ./saved------------
     if (len(os.listdir(folder)) == 0):
         #print oput nothing saved
         self.label = QLabel("Nothing Saved")
         self.layout.addWidget(self.label)
     else:
         for filename in os.listdir(folder):
             self.names.append(filename)
             self.ebutons.append(i)
             self.dbutons.append(i)
             lay = QVBoxLayout()
             gbox = QGroupBox('Result' + str(i + 1))
             path = folder + "/" + filename
             with open(path, 'rb') as thefile:
                 imag = pickle.load(thefile)
             path += ".jpg"
             im = Image.open(
                 requests.get(imag['urls']['thumb'], stream=True).raw)
             im.save(path)
             self.ebutons[i] = QPushButton("Edit")
             self.ebutons[i].clicked.connect(
                 lambda state=i, a=i: self.editme(state))
             self.dbutons[i] = QPushButton("Delete")
             self.dbutons[i].clicked.connect(
                 lambda state=i, a=i: self.deleteme(state))
             pixmap = QPixmap(path)
             self.image = QLabel()
             self.image.setPixmap(pixmap)
             lay.addWidget(self.image)
             buts = QHBoxLayout()
             buts.addWidget(self.ebutons[i])
             buts.addWidget(self.dbutons[i])
             lay.addLayout(buts)
             gbox.setLayout(lay)
             self.layout.addWidget(gbox)
             try:
                 if os.path.isfile(path) or os.path.islink(path):
                     os.unlink(path)
                 elif os.path.isdir(path):
                     shutil.rmtree(path)
             except Exception as e:
                 print('Failed to delete %s. Reason: %s' % (file_path, e))
             i += 1
     print("done")
     self.setLayout(self.layout)
Beispiel #6
0
    def setupUi(self, centralTabs):
        if not centralTabs.objectName():
            centralTabs.setObjectName(u"centralTabs")
        centralTabs.setEnabled(True)
        centralTabs.resize(342, 289)
        sizePolicy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            centralTabs.sizePolicy().hasHeightForWidth())
        centralTabs.setSizePolicy(sizePolicy)
        centralTabs.setAcceptDrops(True)
        centralTabs.setAutoFillBackground(False)
        centralTabs.setDocumentMode(True)
        centralTabs.setTabsClosable(False)
        centralTabs.setMovable(True)
        centralTabs.setTabBarAutoHide(False)
        self.demoPage = QWidget()
        self.demoPage.setObjectName(u"demoPage")
        self.demoPageLayout = QHBoxLayout(self.demoPage)
        self.demoPageLayout.setObjectName(u"demoPageLayout")
        self.stepsLayout = QVBoxLayout()
        self.stepsLayout.setSpacing(10)
        self.stepsLayout.setObjectName(u"stepsLayout")
        self.stepsLayout.setSizeConstraint(QLayout.SetMaximumSize)
        self.stepsLayout.setContentsMargins(0, 0, 0, 0)

        self.demoPageLayout.addLayout(self.stepsLayout)

        centralTabs.addTab(self.demoPage, "")
        self.scriptsPage = QWidget()
        self.scriptsPage.setObjectName(u"scriptsPage")
        self.horizontalLayoutWidget = QWidget(self.scriptsPage)
        self.horizontalLayoutWidget.setObjectName(u"horizontalLayoutWidget")
        self.horizontalLayoutWidget.setGeometry(QRect(210, 120, 74, 26))
        self.scriptsLayout = QHBoxLayout(self.horizontalLayoutWidget)
        self.scriptsLayout.setObjectName(u"scriptsLayout")
        self.scriptsLayout.setContentsMargins(0, 0, 0, 0)
        centralTabs.addTab(self.scriptsPage, "")
        self.productionPage = QWidget()
        self.productionPage.setObjectName(u"productionPage")
        centralTabs.addTab(self.productionPage, "")

        self.retranslateUi(centralTabs)

        centralTabs.setCurrentIndex(0)

        QMetaObject.connectSlotsByName(centralTabs)
Beispiel #7
0
    def initUI(self):
        self.setWindowTitle("QTableWidget demo")
        self.resize(500, 300);
        conLayout = QHBoxLayout()
        self.tableWidget = QTableWidget()
        self.tableWidget.setRowCount(5)
        self.tableWidget.setColumnCount(3)
        conLayout.addWidget(self.tableWidget)

        self.tableWidget.setHorizontalHeaderLabels(['姓名', '性别', '体重'])
        self.tableWidget.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)

        newItem = QTableWidgetItem("张三")
        self.tableWidget.setItem(0, 0, newItem)

        newItem = QTableWidgetItem("男")
        self.tableWidget.setItem(0, 1, newItem)

        newItem = QTableWidgetItem("160")
        self.tableWidget.setItem(0, 2, newItem)
        # 表格中第二行记录
        newItem = QTableWidgetItem("李四")
        self.tableWidget.setItem(1, 0, newItem)

        newItem = QTableWidgetItem("女")
        self.tableWidget.setItem(1, 1, newItem)

        newItem = QTableWidgetItem("170")
        self.tableWidget.setItem(1, 2, newItem)

        self.tableWidget.setContextMenuPolicy(Qt.CustomContextMenu)  ######允许右键产生子菜单
        self.tableWidget.customContextMenuRequested.connect(self.generateMenu)  ####右键菜单
        self.setLayout(conLayout)
Beispiel #8
0
    def init_ui(self):
        self.setLayout(QHBoxLayout(self))
        self.service_view_widget = QServiceView(self)
        self.services_list_widget = QServiceList(self.services, self)

        self.layout().addWidget(self.services_list_widget)
        self.layout().addWidget(self.service_view_widget)
Beispiel #9
0
    def __init__(self, program: Program):
        super().__init__()

        AppGlobals.Instance().onChipOpened.connect(self.CheckForProgram)
        AppGlobals.Instance().onChipModified.connect(self.CheckForProgram)

        self.program = program
        self.modified = False
        self.codeEditor = CodeTextEditor()

        layout = QHBoxLayout()
        self.setLayout(layout)

        self._programNameField = QLineEdit(program.name)
        self._programNameField.textChanged.connect(self.UpdateProgramName)

        self._parameterEditor = ParameterEditor(program)
        self._parameterEditor.onParametersChanged.connect(self.ProgramEdited)

        programNameLabel = QLabel("Name:")
        sideLayout = QVBoxLayout()
        sideLayout.addWidget(programNameLabel)
        sideLayout.addWidget(self._programNameField)
        sideLayout.addWidget(self._parameterEditor)
        layout.addLayout(sideLayout, stretch=0)
        layout.addWidget(self.codeEditor, stretch=1)

        self.codeEditor.SetCode(self.program.script)

        self.codeEditor.codeChanged.connect(self.ProgramEdited)
Beispiel #10
0
 def __init__(self, parent):
     super().__init__(parent)
     self.setLayout(QHBoxLayout(self))
     self.widget_left = LeftWidget(self)
     self.widget_right = RightWidget(self)
     self.layout().addWidget(self.widget_left)
     self.layout().addWidget(self.widget_right)
Beispiel #11
0
    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()
Beispiel #12
0
    def __init__(self, account_id, asset_id, _asset_qty, position, parent=None):
        super().__init__(parent)

        self.account_id = account_id
        self.asset_id = asset_id
        self.asset_name = JalDB().get_asset_name(self.asset_id)
        self.quotes = []
        self.trades = []
        self.currency_name = ''
        self.range = [0, 0, 0, 0]

        self.prepare_chart_data()

        self.chart = ChartWidget(self, self.quotes, self.trades, self.range, self.currency_name)

        self.layout = QHBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)  # Remove extra space around layout
        self.layout.addWidget(self.chart)
        self.setLayout(self.layout)

        self.setWindowTitle(self.tr("Price chart for ") + self.asset_name)
        self.setWindowFlag(Qt.Tool)
        self.setGeometry(position.x(), position.y(), self.width(), self.height())

        self.ready = True
Beispiel #13
0
 def createWaitDialog(self):
     self.waitDialog = QDialog(self)
     self.waitDialogLayout = QHBoxLayout()
     self.waitDialogLabel = QLabel()
     self.waitDialogLayout.addWidget(self.waitDialogLabel)
     self.waitDialog.setLayout(self.waitDialogLayout)
     self.waitDialog.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint)
Beispiel #14
0
 def __init__(self):
     """Displays additional game information such as latest movement and score"""
     super().__init__()
     self.game_info = QHBoxLayout(self)
     # self.game_info.addWidget(QLabel("WOOOOOOO"))
     self.__add_last_movement_info()
     self.__add_score_info()
Beispiel #15
0
            def __init__(self, result, parent=None):
                # An item of ResultsList
                # result: (dict) represents details (playlist or song search)
                QToolButton.__init__(self)
                self.setParent(parent)
                self.result = result

                # Button formatting
                self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
                self.setFixedHeight(70)
                self.setAutoRaise(True)
                # TODO: change with global themes
                self.setStyleSheet(
                    "QToolButton:pressed { background-color: rgba(255, 255, 255, 0.1)} QToolButton { background-color: rgba(255, 255, 255, 0.05); border: 1px solid white}"
                )

                # Set layout
                self.layout = QHBoxLayout()
                self.layout.setContentsMargins(0, 0, 0, 0)
                self.layout.setSpacing(0)

                # Depending on result type, add action when the item is clicked
                if result["type"] == "songs":
                    self.formatTitle()
                    self.clicked.connect(self.clickedSong)
                elif result["type"] == "playlists":
                    self.formatPlaylist()
                    self.clicked.connect(self.clickedPlaylist)
                self.setLayout(self.layout)
Beispiel #16
0
    def __init__(self):
        super(MainWindow, self).__init__()

        self.setWindowTitle("My App")
        pagelayout = QVBoxLayout()
        button_layout = QHBoxLayout()
        self.stacklayout = QStackedLayout()

        pagelayout.addLayout(button_layout)
        pagelayout.addLayout(self.stacklayout)

        btn = QPushButton("red")
        btn.pressed.connect(self.activate_tab_1)
        button_layout.addWidget(btn)
        self.stacklayout.addWidget(Color("red"))

        btn = QPushButton("green")
        btn.pressed.connect(self.activate_tab_2)
        button_layout.addWidget(btn)
        self.stacklayout.addWidget(Color("green"))

        btn = QPushButton("yellow")
        btn.pressed.connect(self.activate_tab_3)
        button_layout.addWidget(btn)
        self.stacklayout.addWidget(Color("yellow"))

        widget = QWidget()
        widget.setLayout(pagelayout)
        self.setCentralWidget(widget)
    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
    def init_ui(self):

        self.setLayout(QHBoxLayout())
        self.tree = QTreeView(self)
        self.tree.setModel(self.services)
        # self.tree.setHeaderHidden(True)
        self.layout().addWidget(self.tree)
    def __init__(self):
        QWidget.__init__(self)
        self.items = 0

        # Example data
        self._data = {
            "Water": 24.5,
            "Electricity": 55.1,
            "Rent": 850.0,
            "Supermarket": 230.4,
            "Internet": 29.99,
            "Spätkauf": 21.85,
            "BVG Ticket": 60.0,
            "Coffee": 22.45,
            "Meetup": 0.0
        }

        # Left
        self.table = QTableWidget()
        self.table.setColumnCount(2)
        self.table.setHorizontalHeaderLabels(["Description", "Quantity"])
        self.table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)

        # QWidget Layout
        self.layout = QHBoxLayout()

        self.layout.addWidget(self.table)

        # Set the layout to the QWidget
        self.setLayout(self.layout)

        # Fill example data
        self.fill_table()
Beispiel #20
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 #21
0
    def initUI(self):
        self.setWindowTitle("QTableWidget 例子")
        self.resize(430, 300);
        conLayout = QHBoxLayout()
        tableWidget = QTableWidget()
        tableWidget.setRowCount(4)
        tableWidget.setColumnCount(3)
        conLayout.addWidget(tableWidget)

        tableWidget.setHorizontalHeaderLabels(['姓名', '性别', '体重(kg)'])

        newItem = QTableWidgetItem("张三")
        tableWidget.setItem(0, 0, newItem)

        comBox = QComboBox()
        comBox.addItem("男")
        comBox.addItem("女")
        comBox.setStyleSheet("QComboBox{margin:3px};")
        tableWidget.setCellWidget(0, 1, comBox)

        searchBtn = QPushButton("修改")
        searchBtn.setDown(True)
        searchBtn.setStyleSheet("QPushButton{margin:3px};")
        tableWidget.setCellWidget(0, 2, searchBtn)

        self.setLayout(conLayout)
Beispiel #22
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)
Beispiel #23
0
    def __init__(self):
        super().__init__()

        btn1 = QPushButton(self)
        btn2 = QPushButton(self)
        btn3 = QPushButton(self)
        btn1.setText('button 1')
        btn2.setText('button 2')
        btn3.setText('button 3')

        hbox = QHBoxLayout()
        # 设置伸缩量为1
        hbox.addStretch(1)
        hbox.addWidget(btn1)
        # 设置伸缩量为1
        hbox.addStretch(1)
        hbox.addWidget(btn2)
        # 设置伸缩量为1
        hbox.addStretch(1)
        hbox.addWidget(btn3)
        # 设置伸缩量为1
        hbox.addStretch(1)

        self.setLayout(hbox)
        self.setWindowTitle("addStretch 例子")
Beispiel #24
0
    def __init__(self):
        super(MainWindow, self).__init__()

        self.setWindowTitle("My App")

        layout1 = QHBoxLayout()
        layout2 = QVBoxLayout()
        layout3 = QVBoxLayout()

        layout2.addWidget(Color("red"))
        layout2.addWidget(Color("yellow"))
        layout2.addWidget(Color("purple"))

        layout1.addLayout(layout2)

        layout1.addWidget(Color('green'))

        layout3.addWidget(Color("red"))
        layout3.addWidget(Color("purple"))

        layout1.addLayout(layout3)

        widget = QWidget()
        widget.setLayout(layout1)
        self.setCentralWidget(widget)
Beispiel #25
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.completer = None
        self.p_selected_id = 0

        self.layout = QHBoxLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.name = QLineEdit()
        self.name.setText("")
        self.layout.addWidget(self.name)
        self.details = QLabel()
        self.details.setText("")
        self.details.setVisible(False)
        self.layout.addWidget(self.details)
        self.button = QPushButton("...")
        self.button.setFixedWidth(
            self.button.fontMetrics().horizontalAdvance("XXXX"))
        self.layout.addWidget(self.button)
        self.setLayout(self.layout)

        self.setFocusProxy(self.name)

        self.button.clicked.connect(self.on_button_clicked)

        if self.details_field:
            self.name.setFixedWidth(
                self.name.fontMetrics().horizontalAdvance("X") * 15)
            self.details.setVisible(True)
        self.completer = QCompleter(self.dialog.model.completion_model)
        self.completer.setCompletionColumn(
            self.dialog.model.completion_model.fieldIndex(self.selector_field))
        self.completer.setCaseSensitivity(Qt.CaseInsensitive)
        self.name.setCompleter(self.completer)
        self.completer.activated[QModelIndex].connect(self.on_completion)
Beispiel #26
0
    def __init__(self):
        super(Window, self).__init__()
        self.installEventFilter(self)

        layout = QHBoxLayout()

        layout.setSpacing(0)
        layout.setContentsMargins(10, 10, 10, 10)

        layout.addWidget(self.createMainSection())
        layout.setStretch(0, 580)
        self.patchbay = self.createPatchbay()
        layout.addWidget(self.patchbay)
        layout.setStretch(1, 280)

        layout.setSpacing(8)

        self.setStyleSheet(mainWindowStyleSheet())

        centralWidget = QWidget(self)
        self.setCentralWidget(centralWidget)
        centralWidget.setLayout(layout)

        self.setWindowTitle("Sharm v2")
        path = join("gui", "images", "icon.svg")
        self.setWindowIcon(QtGui.QIcon(path))
        # self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint)
        self.setFocus()
Beispiel #27
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)
    def __init__(self, show_time=True):
        """Opens a progress bar widget
        :type show_time: bool
        :param show_time: If the time should be shown below the progress bar"""
        super().__init__()
        # Setup parameters
        self._show_time: bool = show_time
        self._timer_start: float = 0

        # General layout
        self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
        self._layout = QVBoxLayout()
        self.setLayout(self._layout)
        # The progress bar itself
        self._progress_bar = QProgressBar(self)
        self._progress_bar.setMaximum(100)
        self._progress_bar.setGeometry(0, 0, 350, 25)
        self._progress_bar.setValue(0)
        self._layout.addWidget(self._progress_bar)
        # Setup time display
        self._time_wrapper = QHBoxLayout()
        self._time_expired_label = QLabel("")
        self._time_expired_label.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
        self._time_left_label = QLabel("")
        self._time_left_label.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
        self._time_wrapper.addWidget(self._time_expired_label)
        self._time_wrapper.addWidget(self._time_left_label)
        self._layout.addLayout(self._time_wrapper)
        # Set Size
        self.resize(500, 80)
        # Register progress update handler
        # noinspection PyUnresolvedReferences
        self.set_progress.connect(self._set_progress)
Beispiel #29
0
    def __init__(self,
                 account_id,
                 asset_id,
                 currency_id,
                 _asset_qty,
                 parent=None):
        super().__init__(parent)

        self.account_id = account_id
        self.asset_id = asset_id
        self.currency_id = currency_id if asset_id != currency_id else 1  # Check whether we have currency or asset
        self.asset_name = JalDB().get_asset_name(self.asset_id)
        self.quotes = []
        self.trades = []
        self.currency_name = ''
        self.range = [0, 0, 0, 0]

        self.prepare_chart_data()

        self.chart = ChartWidget(self, self.quotes, self.trades, self.range,
                                 self.currency_name)

        self.layout = QHBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0,
                                       0)  # Remove extra space around layout
        self.layout.addWidget(self.chart)
        self.setLayout(self.layout)

        self.setWindowTitle(self.tr("Price chart for ") + self.asset_name)

        self.ready = True
Beispiel #30
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()