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()
Exemple #2
0
    def __init__(self):
        QWidget.__init__(self)
        self.expression = ""
        buttons = {
            "zero": "0",
            "one": "1",
            "two": "2",
            "three": "3",
            "four": "4",
            "five": "5",
            "six": "6",
            "seven": "7",
            "eight": "8",
            "nine": "9",
            "comma": ".",
            "add": "+",
            "substract": "-",
            "multiply": "×",
            "divide": "÷",
            "power": "^",
            "openingParenthesis": "(",
            "closingParenthesis": ")"
        }
        for btn in buttons.items():

            def fun(wtf=False, writes=btn[1]):
                self.expression += writes
                self.update()

            self.__setattr__(btn[0], fun)
        self.ui = Ui_Calculator()
        self.ui.setupUi(self)

        with open("qss/light.qss", "r") as f:
            self.setStyleSheet(f.read())
Exemple #3
0
    def __init__(self, parent=None):
        QWidget.__init__(self)
        self.setParent(parent)
        
        # Set the colour of the overlay
        self.setStyleSheet("QWidget { background-color: rgba(255, 255, 255, 0.05)}")

        # Set OverlayTop heights
        # TODO: Change heights with increasing resolution
        self.setFixedHeight(50)

        # Create layout with margins/spacings
        layout = QGridLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        # Initialise MarqueeText
        self.marqueeText = self.MarqueeText(self)
        layout.addWidget(self.marqueeText, 0, 0, 2, 1)
        
        # Initialise search button
        self.initButton()
        layout.addWidget(self.button, 0, 1, 2, 1)

        # Initialise elapsedTime/localTime
        self.initTimes()
        layout.addWidget(self.elapsedTime, 0, 2, 1, 1)
        layout.addWidget(self.localTime, 1, 2, 1, 1)
        
        self.setLayout(layout)
Exemple #4
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)
Exemple #5
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)
Exemple #6
0
    def __init__(self):
        QWidget.__init__(self)

        self.model = CustomTableModel()

        self.table_view = QTableView()
        self.table_view.setModel(self.model)
        self.table_view.horizontalHeader().setSectionResizeMode(
            QHeaderView.Stretch)
        self.table_view.verticalHeader().setSectionResizeMode(
            QHeaderView.Stretch)

        self.chart = QtCharts.QChart()
        self.chart.setAnimationOptions(QtCharts.QChart.AllAnimations)

        self.series = QtCharts.QLineSeries()
        self.series.setName("Line 1")
        self.mapper = QtCharts.QVXYModelMapper(self)
        self.mapper.setXColumn(0)
        self.mapper.setYColumn(1)
        self.mapper.setSeries(self.series)
        self.mapper.setModel(self.model)
        self.chart.addSeries(self.series)

        # for storing color hex from the series
        seriesColorHex = "#000000"

        # get the color of the series and use it for showing the mapped area
        seriesColorHex = "{}".format(self.series.pen().color().name())
        self.model.add_mapping(seriesColorHex,
                               QRect(0, 0, 2, self.model.rowCount()))

        # series 2
        self.series = QtCharts.QLineSeries()
        self.series.setName("Line 2")

        self.mapper = QtCharts.QVXYModelMapper(self)
        self.mapper.setXColumn(2)
        self.mapper.setYColumn(3)
        self.mapper.setSeries(self.series)
        self.mapper.setModel(self.model)
        self.chart.addSeries(self.series)

        # get the color of the series and use it for showing the mapped area
        seriesColorHex = "{}".format(self.series.pen().color().name())
        self.model.add_mapping(seriesColorHex,
                               QRect(2, 0, 2, self.model.rowCount()))

        self.chart.createDefaultAxes()
        self.chart_view = QtCharts.QChartView(self.chart)
        self.chart_view.setRenderHint(QPainter.Antialiasing)
        self.chart_view.setMinimumSize(640, 480)

        # create main layout
        self.main_layout = QGridLayout()
        self.main_layout.addWidget(self.table_view, 1, 0)
        self.main_layout.addWidget(self.chart_view, 1, 1)
        self.main_layout.setColumnStretch(1, 1)
        self.main_layout.setColumnStretch(0, 0)
        self.setLayout(self.main_layout)
Exemple #7
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):
        QWidget.__init__(self)
        self.setMinimumSize(800, 600)
        self.donuts = []
        self.chart_view = QChartView()
        self.chart_view.setRenderHint(QPainter.Antialiasing)
        self.chart = self.chart_view.chart()
        self.chart.legend().setVisible(False)
        self.chart.setTitle("Nested donuts demo")
        self.chart.setAnimationOptions(QChart.AllAnimations)

        self.min_size = 0.1
        self.max_size = 0.9
        self.donut_count = 5

        self.setup_donuts()

        # create main layout
        self.main_layout = QGridLayout(self)
        self.main_layout.addWidget(self.chart_view, 1, 1)
        self.setLayout(self.main_layout)

        self.update_timer = QTimer(self)
        self.update_timer.timeout.connect(self.update_rotation)
        self.update_timer.start(1250)
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.model = None
        self.table_name = ''
        self.mapper = None
        self.modified = False
        self.name = "N/A"
        self.operation_type = None

        self.layout = QGridLayout(self)
        self.layout.setContentsMargins(2, 2, 2, 2)

        self.bold_font = QFont()
        self.bold_font.setBold(True)

        self.main_label = QLabel(self)
        self.main_label.setFont(self.bold_font)
        self.layout.addWidget(self.main_label, 0, 0, 1, 1, Qt.AlignLeft)

        self.commit_button = QPushButton(load_icon("accept.png"), '', self)
        self.commit_button.setToolTip(self.tr("Commit changes"))
        self.commit_button.setEnabled(False)
        self.revert_button = QPushButton(load_icon("cancel.png"), '', self)
        self.revert_button.setToolTip(self.tr("Cancel changes"))
        self.revert_button.setEnabled(False)

        self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                          QSizePolicy.Expanding)
        self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                            QSizePolicy.Minimum)
Exemple #10
0
 def __init__(self):
     QWidget.__init__(self)
     self.setWindowTitle("My Form")
     self.layout = QVBoxLayout()
     self.button = QPushButton("Click me!")
     self.button.clicked.connect(self.start_thread)
     self.layout.addWidget(self.button)
     self.setLayout(self.layout)
Exemple #11
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        self.charts = []

        self.ui = ui()
        self.list_count = 3
        self.value_max = 10
        self.value_count = 7
        self.data_table = self.generate_random_data(self.list_count,
                                                    self.value_max,
                                                    self.value_count)

        self.ui.setupUi(self)
        self.populate_themebox()
        self.populate_animationbox()
        self.populate_legendbox()

        # Area Chart
        chart_view = QtCharts.QChartView(self.create_areachart())
        self.ui.gridLayout.addWidget(chart_view, 1, 0)
        self.charts.append(chart_view)

        # Pie Chart
        chart_view = QtCharts.QChartView(self.createPieChart())
        chart_view.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
        self.ui.gridLayout.addWidget(chart_view, 1, 1)
        self.charts.append(chart_view)

        # Line Chart
        chart_view = QtCharts.QChartView(self.createLineChart())
        self.ui.gridLayout.addWidget(chart_view, 1, 2)
        self.charts.append(chart_view)

        # Bar Chart
        chart_view = QtCharts.QChartView(self.createBarChart())
        self.ui.gridLayout.addWidget(chart_view, 2, 0)
        self.charts.append(chart_view)

        # Spline Chart
        chart_view = QtCharts.QChartView(self.createSplineChart())
        self.ui.gridLayout.addWidget(chart_view, 2, 1)
        self.charts.append(chart_view)

        # Scatter Chart
        chart_view = QtCharts.QChartView(self.create_scatterchart())
        self.ui.gridLayout.addWidget(chart_view, 2, 2)
        self.charts.append(chart_view)

        # Set defaults
        self.ui.antialiasCheckBox.setChecked(True)

        # Set the colors from the light theme as default ones
        pal = qApp.palette()
        pal.setColor(QPalette.Window, QColor(0xf0f0f0))
        pal.setColor(QPalette.WindowText, QColor(0x404044))
        qApp.setPalette(pal)

        self.updateUI()
Exemple #12
0
        def __init__(self, editor):
            QWidget.__init__(self, editor)
            global bnstyles

            self.editor = editor
            self.editor.blockCountChanged.connect(self.updateWidth)
            self.editor.updateRequest.connect(self.updateContents)
            self.font = QFont()
            self.numberBarColor = bnstyles["numberBar"]
    def __init__(self):
        self.db = ClientesDB()
        QWidget.__init__(self)
        font = QFont()
        font.setBold(True)  # Labels em Negrito

        # Labels:
        self.label_title = QLabel("Novo Cliente")
        self.label_title.setFont(font)
        self.label_nome = QLabel("Nome Completo:")
        self.label_nome.setFont(font)
        self.label_endereco = QLabel("Endereço:")
        self.label_endereco.setFont(font)
        self.label_numero = QLabel("Número:")
        self.label_numero.setFont(font)
        self.label_cpf = QLabel("CPF:")
        self.label_cpf.setFont(font)

        # Entries:
        self.entry_nome = QLineEdit()
        self.entry_endereco = QTextEdit()
        self.entry_numero = QLineEdit()
        self.entry_cpf = QLineEdit()

        # Botões;
        self.button_salvar = QPushButton("&Salvar")
        self.button_salvar.clicked.connect(self.salvar_cliente)
        self.button_salvar.setShortcut("Ctrl+S")
        self.button_cancelar = QPushButton("Cancelar")
        self.button_cancelar.clicked.connect(self.limpar)
        self.button_cancelar.setShortcut("ESC")

        # Linha
        self.line = QFrame()
        self.line.setFrameShape(QFrame.HLine)
        self.line.setFrameShadow(QFrame.Sunken)
        self.line.setLineWidth(0)
        self.line.setMidLineWidth(1)

        # Leiaute:
        self.layout = QVBoxLayout()
        self.layout_buttons = QHBoxLayout()
        self.layout.addWidget(self.label_title)
        self.layout.addWidget(self.line)
        self.layout.addWidget(self.label_nome)
        self.layout.addWidget(self.entry_nome)
        self.layout.addWidget(self.label_numero)
        self.layout.addWidget(self.entry_numero)
        self.layout.addWidget(self.label_cpf)
        self.layout.addWidget(self.entry_cpf)
        self.layout.addWidget(self.label_endereco)
        self.layout.addWidget(self.entry_endereco)
        self.layout_buttons.addWidget(self.button_salvar)
        self.layout_buttons.addWidget(self.button_cancelar)
        self.layout.addStretch(2)
        self.layout.addLayout(self.layout_buttons)
        self.setLayout(self.layout)
Exemple #14
0
    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)

        # Right
        self.description = QLineEdit()
        self.quantity = QLineEdit()
        self.add = QPushButton("Add")
        self.clear = QPushButton("Clear")
        self.quit = QPushButton("Quit")

        self.right = QVBoxLayout()
        self.right.setContentsMargins(10, 10, 10, 10)
        self.right.addWidget(QLabel("Description"))
        self.right.addWidget(self.description)
        self.right.addWidget(QLabel("Quantity"))
        self.right.addWidget(self.quantity)
        self.right.addWidget(self.add)
        self.right.addStretch()
        self.right.addWidget(self.quit)

        # QWidget Layout
        self.layout = QHBoxLayout()

        self.layout.addWidget(self.table)
        self.layout.addLayout(self.right)

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

        # Signals and Slots
        self.add.clicked.connect(self.add_element)
        self.quit.clicked.connect(self.quit_application)
        self.clear.clicked.connect(self.clear_table)

        # Fill example data
        self.fill_table()
Exemple #15
0
 def __init__(self, bridge):
     QWidget.__init__(self)
     BaseLog.__init__(self, verbose=True)
     self.setWindowTitle("Hue Controller")
     self._light_ctrl = []
     self._bridge = bridge
     self.layout = QVBoxLayout(self)
     for _room in self._bridge.rooms:
         self.layout.addWidget(self._setup_room_widget(_room))
     self.set_log_prefix("HUE_CONTROL_WINDOW")
Exemple #16
0
    def __init__(self, parent=None):
        QWidget.__init__(self)
        self.setParent(parent)

        # Create layout with margins/spacings
        layout = QGridLayout()
        layout.setContentsMargins(20, 20, 20, 20)
        layout.setSpacing(10)

        self.setLayout(self.initButtons(layout))
Exemple #17
0
 def __init__(self, parent: Optional[QWidget] = None, index: int = 0):
     QWidget.__init__(self, parent)
     UiLoad().loadUi("tab.ui", self, parent)
     self.index: int = index  # NOTE: index of the currently selected step
     self.demo_idx: int = 0  # NOTE: index of currently selected demo
     self.apply_to_demo: Optional[
         Demo] = None  #Stores in memory the demo which the operation will be performed on
     self.apply_to_mask: Optional[List[List[
         bool]]] = None  #Maps every step in every section to True/false value to apply op to
     self.load_ui()
Exemple #18
0
    def __init__(self, fd):
        QWidget.__init__(self)
        self.__fd = fd

        self.__HLAYOUT_BYTE = "layout_byte"
        self.__CHECK_BOX_DATA_BIT = "data_byte"

        self.__DESCRIPTION = "description"
        self.init_ui()
        self.btn_send.clicked.connect(self.send_data)
    def __init__(self):
        QWidget.__init__(self)

        self.init_ui()

        self.combobox.currentTextChanged.connect(self.slot_combo_textchanged)
        self.btn_open_conn.clicked.connect(self.slot_conn_clicked)
        self.btn_close_conn.clicked.connect(self.slot_conn_close)
        self.btn_status.clicked.connect(self.slot_send_status_packet)
        self.btn_head.clicked.connect(self.slot_send_head_packet)
        self.btn_motion.clicked.connect(self.slof_send_motion_packet)
    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)
Exemple #21
0
    def __init__(self, parent, quotes, trades, data_range, currency_name):
        QWidget.__init__(self, parent)
        self.setMinimumWidth(600)
        self.setMinimumHeight(400)

        self.quotes_series = QLineSeries()
        for point in quotes:  # Conversion to 'float' in order not to get 'int' overflow on some platforms
            self.quotes_series.append(float(point['timestamp']),
                                      point['quote'])

        self.trade_series = QScatterSeries()
        for point in trades:  # Conversion to 'float' in order not to get 'int' overflow on some platforms
            self.trade_series.append(float(point['timestamp']), point['price'])
        self.trade_series.setMarkerSize(5)
        self.trade_series.setBorderColor(CustomColor.LightRed)
        self.trade_series.setBrush(CustomColor.DarkRed)

        axisX = QDateTimeAxis()
        axisX.setTickCount(11)
        axisX.setRange(QDateTime().fromSecsSinceEpoch(data_range[0]),
                       QDateTime().fromSecsSinceEpoch(data_range[1]))
        axisX.setFormat("yyyy/MM/dd")
        axisX.setLabelsAngle(-90)
        axisX.setTitleText("Date")

        axisY = QValueAxis()
        axisY.setTickCount(11)
        axisY.setRange(data_range[2], data_range[3])
        axisY.setTitleText("Price, " + currency_name)

        self.chartView = QChartView()
        self.chartView.chart().addSeries(self.quotes_series)
        self.chartView.chart().addSeries(self.trade_series)
        self.chartView.chart().addAxis(axisX, Qt.AlignBottom)
        self.chartView.chart().setAxisX(axisX, self.quotes_series)
        self.chartView.chart().setAxisX(axisX, self.trade_series)
        self.chartView.chart().addAxis(axisY, Qt.AlignLeft)
        self.chartView.chart().setAxisY(axisY, self.quotes_series)
        self.chartView.chart().setAxisY(axisY, self.trade_series)
        self.chartView.chart().legend().hide()
        self.chartView.setViewportMargins(0, 0, 0, 0)
        self.chartView.chart().layout().setContentsMargins(
            0, 0, 0, 0)  # To remove extra spacing around chart
        self.chartView.chart().setBackgroundRoundness(
            0)  # To remove corner rounding
        self.chartView.chart().setMargins(QMargins(
            0, 0, 0, 0))  # Allow chart to fill all space

        self.layout = QHBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0,
                                       0)  # Remove extra space around layout
        self.layout.addWidget(self.chartView)
        self.setLayout(self.layout)
    def __init__(self, ruler, parent=None):
        QWidget.__init__(self, parent)

        # colors settings
        backgroundColor = ruler.data.get('background_color')
        linesColor = ruler.data.get('lines_color')
        divisionsColor = ruler.data.get('divisions_color')

        def updateBackgroundColor(newColor):
            ruler.data.update('background_color', newColor)
            ruler.update()

        def updateLinesColor(newColor):
            ruler.data.update('lines_color', newColor)
            ruler.update()

        def updateDivisionsColor(newColor):
            ruler.data.update('divisions_color', newColor)
            ruler.update()

        backgroundColorElement = ColorButton(self, 'Background',
                                             backgroundColor,
                                             updateBackgroundColor)
        linesColorElement = ColorButton(self, 'Lines', linesColor,
                                        updateLinesColor)
        divisionsColorElement = ColorButton(self, 'Divisions', divisionsColor,
                                            updateDivisionsColor)

        layout = QGridLayout()
        layout.setSpacing(10)

        # set the same width/height for all the columns/rows
        columnWidth = 120
        rowHeight = 25
        layout.setRowMinimumHeight(0, rowHeight)
        layout.setRowMinimumHeight(1, rowHeight)
        layout.setRowMinimumHeight(2, rowHeight)
        layout.setColumnMinimumWidth(0, columnWidth)
        layout.setColumnMinimumWidth(1, columnWidth)
        layout.setColumnMinimumWidth(2, columnWidth)

        # first column
        layout.addWidget(backgroundColorElement, 1, 0)

        # second column
        layout.addWidget(linesColorElement, 1, 1)

        # third column
        layout.addWidget(divisionsColorElement, 1, 2)

        layout.setSizeConstraint(QLayout.SetFixedSize)
        self.setLayout(layout)
Exemple #23
0
    def __init__(self, name, parent=None):
        QWidget.__init__(self, parent)
        DockContextHandler.__init__(self, self, name)

        self.base = BinjaWidgetBase()

        #self._main_window.addDockWidget(Qt.RightDockWidgetArea, self)
        #self._tabs = QTabWidget()
        #self._tabs.setTabPosition(QTabWidget.East)
        #self.setWidget(self._tabs)

        # self.hide()
        self.show()
Exemple #24
0
    def __init__(self, parent: QWidget | None) -> None:
        QWidget.__init__(self, parent)
        UiLoad().loadUi("steps.ui", self, parent)
        self.load_data()
        # self.

        self.addStepBtn = self.widget(0).findChild(QPushButton, "addStepBtn")
        self.removeStepBtn = self.findChild(type=QPushButton, name="removeStepBtn")
        self.stepUpBtn = self.findChild(QPushButton, "stepUpBtn")
        self.stepDownBtn = self.findChild(QPushButton, "stepDownBtn")
        self.runBtn = self.findChild(QPushButton, "runBtn")

        self.load_data()
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     self.m_min = 0
     self.m_max = 100
     self.m_value = 25
     self.m_nullPosition = QRoundProgressBar.PositionTop
     self.m_barStyle = self.BarStyle.DONUT
     self.m_outlinePenWidth = 1
     self.m_dataPenWidth = 1
     self.m_rebuildBrush = False
     self.m_format = '%p%'
     self.m_decimals = 1
     self.m_updateFlags = self.UpdateFlags.PERCENT
     self.m_gradientData = None
Exemple #26
0
    def __init__(self, parent=None):
        QWidget.__init__(self)
        self.setParent(parent)

        # Set the colour of the overlay
        self.setStyleSheet("QWidget { background-color: rgba(255, 255, 255, 0.05)}")

        # Set OverlayBottom heights
        # TODO: Change heights with increasing resolution
        self.setFixedHeight(100)

        # Create layout with margins/spacings
        layout = QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        # Initialise buttons
        buttons = []
        args = ["home", "user", "windows", "back", "play-pause", "next"]
        for i in args:
            button = QToolButton()
            button.setIcon(QIcon("icons/{}.svg".format(i)))
            button.setAutoRaise(True)
            button.setStyleSheet("QToolButton:pressed { background-color: rgba(255, 255, 255, 0.1)}")
            buttons.append(button)

        # TODO: Solve this. Lambda functions cannot be used in loops. This is a stupid workaround
        buttons[0].clicked.connect(lambda: self.buttonAction(args[0]))
        buttons[1].clicked.connect(lambda: self.buttonAction(args[1]))
        buttons[2].clicked.connect(lambda: self.buttonAction(args[2]))
        buttons[3].clicked.connect(lambda: self.buttonAction(args[3]))
        buttons[4].clicked.connect(lambda: self.buttonAction(args[4]))
        buttons[5].clicked.connect(lambda: self.buttonAction(args[5]))

        # Add blank widget to start and end to group and center buttons (pt1)
        layout.addWidget(QWidget())

        # Set IconSize, widths, and SizePolicy of each button. Then proceed to add to layout
        for x in buttons:
            x.setIconSize(QSize(35, 35))
            # TODO: Scale with resize
            x.setFixedWidth(150)
            x.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)
            layout.addWidget(x)

        # Add blank widget to start and end to group and center buttons (pt2)
        layout.addWidget(QWidget())

        self.setLayout(layout)
Exemple #27
0
    def __init__(self):
        QWidget.__init__(self)
        self.view_type = ViewTypeWidget()
        self.layout = QHBoxLayout()
        self.layout.setSpacing(0)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.addWidget(self.view_type)

        self.about_button = AboutButton()
        self.layout.addWidget(self.about_button)

        self.close_button = CloseButton(config()['window']['frameless'])
        self.layout.addWidget(self.close_button)

        self.setLayout(self.layout)
Exemple #28
0
    def __init__(self, ruler, parent=None):
        QWidget.__init__(self, parent)

        self.ruler = ruler
        self.generalTab = OptionsGeneralTab(ruler)
        self.colorsTab = OptionsColorsTab(ruler)

        self.tabWidget = QTabWidget()
        self.tabWidget.addTab(self.generalTab, "General")
        self.tabWidget.addTab(self.colorsTab, "Colors")

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(self.tabWidget)
        self.setLayout(mainLayout)
        self.setWindowTitle("Options")
Exemple #29
0
 def __init__(self, light: LightBulb):
     QWidget.__init__(self)
     BaseLog.__init__(self, verbose=True)
     self._light: LightBulb = light
     self._btn = self._init_toggle_button()
     self._update_button()
     self._slider = self._init_brightness_slider()
     self._update_timer = self._init_update_timer()
     self._color_picker = self._init_color_picker()
     self._cp_btn = QPushButton("Set Color")
     self._cp_btn.clicked.connect(self._open_color_picker)
     self._need_update = False
     self.set_log_prefix(
         f"CONTROL_{self._light.name.upper().replace(' ', '_')}")
     self.log("init")
    def __init__(self):
        QWidget.__init__(self)

        # 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
        }