Exemplo n.º 1
0
 def __init__(self, parent):
     super().__init__(parent)
     self.setLayout(QVBoxLayout(self))
     self.label_workouts = QLabel("Workouts", self)
     self.layout().addWidget(self.label_workouts)
     self.table_workouts = QTableWidget(self)
     self.layout().addWidget(self.table_workouts)
     self.frame_hline = HLineSunken(self)
     self.layout().addWidget(self.frame_hline)
     self.label_performed_exercises = QLabel(
         "Performed Exercises: Double click a line in the "
         "workouts table!", self)
     self.layout().addWidget(self.label_performed_exercises)
     self.table_performed_exercises = QTableWidget(self)
     self.layout().addWidget(self.table_performed_exercises)
Exemplo n.º 2
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)
Exemplo n.º 3
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)
Exemplo n.º 4
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()
Exemplo n.º 5
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)

        # 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()
Exemplo n.º 6
0
    def __init__(self) -> None:
        super().__init__()
        self.resize(500, 300)

        # 非组件对象
        self.values = {}
        self.ut = UpdateValues()
        # 界面组件对象

        self.centralwidget = QWidget(self)
        self.table = QTableWidget(self.centralwidget)
        self.startButton = QPushButton(self.centralwidget, text='开始')
        self.stopButton = QPushButton(self.centralwidget, text='停止')
        self.stopButton.setDisabled(True)
        self.table.setColumnCount(3)
        self.table.setHorizontalHeaderItem(0, QTableWidgetItem('GID'))
        self.table.setHorizontalHeaderItem(2, QTableWidgetItem('name'))
        self.table.setHorizontalHeaderItem(1, QTableWidgetItem('speed'))
        self.table.horizontalHeader().setStretchLastSection(True)
        self.table.setRowCount(1)

        self.layout = QGridLayout(self.centralwidget)

        self.layout.addWidget(self.startButton)
        self.layout.addWidget(self.stopButton)
        self.layout.addWidget(self.table)

        self.setCentralWidget(self.centralwidget)

        self.ut.resultReady.connect(self.on_changeValue)
        self.startButton.clicked.connect(self.changeValue)
        self.stopButton.clicked.connect(self.stopUpdate)
Exemplo n.º 7
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()
Exemplo n.º 8
0
 def __init__(self, title, parent):
     super().__init__(title, parent)
     self.__layout = QGridLayout(self)
     self.setLayout(self.__layout)
     self.combobox_category = ComboboxCategory(self)
     self.__layout.addWidget(self.combobox_category, 0, 0)
     self.combobox_muscles = ComboboxMuscles(self)
     self.__layout.addWidget(self.combobox_muscles, 0, 1)
     self.combobox_difficulty = ComboboxDifficulty(self)
     self.__layout.addWidget(self.combobox_difficulty, 0, 2)
     self.table_available_exercises = QTableWidget(self)
     self.__layout.addWidget(self.table_available_exercises, 1, 0, 1, 3)
Exemplo n.º 9
0
    def create_table(self, group_name):
        table = QTableWidget(0, len(self.table_headers))
        table.setHorizontalHeaderLabels(self.table_headers)
        table.resizeColumnsToContents()

        layout = QVBoxLayout()
        layout.addWidget(QLabel(group_name))
        layout.addWidget(table)

        self.layout.addLayout(layout)

        return table
Exemplo n.º 10
0
 def __init__(self):
     super().__init__()
     self.setWindowTitle("Example")
     self.layout = QGridLayout()
     self.layout.setContentsMargins(6, 6, 6, 6)
     self.layout.addWidget(QTableWidget(), 0, 0, 1, 3)
     self.loading_bar = QProgressBar()
     self.loading_bar.setTextVisible(False)
     self.loading_bar.setValue(25)
     self.layout.addWidget(self.loading_bar, 1, 0, 1, 1)
     self.refresh_btn = FixedWindowsButton("Refresh")
     self.layout.addWidget(self.refresh_btn, 1, 1, 1, 1)
     self.execute_btn = FixedWindowsButton("Execute")
     self.layout.addWidget(self.execute_btn, 1, 2, 1, 1)
     self.setLayout(self.layout)
Exemplo n.º 11
0
    def __init__(self):
        self.db = ClientesDB()
        QWidget.__init__(self)
        Font = QFont()
        Font.setBold(True)  # Labels em Negrito

        # Entry:
        self.entry_nome = QLineEdit()
        self.entry_nome.setText("Nome para Busca")

        # Botões
        self.button_busca = QPushButton("&Busca")
        self.button_busca.clicked.connect(self.buscar)
        self.button_busca.setShortcut("Ctrl+B")
        self.button_limpar = QPushButton("Limpar")
        self.button_limpar.clicked.connect(self.limpar)
        self.button_limpar.setShortcut("ESC")

        # Tabela
        self.clientes = 0
        self.tabela_clientes = QTableWidget()
        self.tabela_clientes.setColumnCount(4)
        self.tabela_clientes.setHorizontalHeaderLabels([
            "Nome",
            "Número",
            "CPF",
            "Endereço",
        ])
        self.tabela_clientes.horizontalHeader().setSectionResizeMode(
            QHeaderView.ResizeToContents)
        self.tabela_clientes.horizontalHeader().setStretchLastSection(True)
        self.tabela_clientes.resizeColumnsToContents()
        self.tabela_clientes.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.tabela_clientes.itemDoubleClicked.connect(self.info_cliente)

        #Leiaute:
        self.layout = QVBoxLayout()
        self.layout_busca = QHBoxLayout()
        self.layout_busca.addWidget(self.entry_nome)
        self.layout_busca.addWidget(self.button_busca)
        self.layout.addLayout(self.layout_busca)
        self.layout.addWidget(self.tabela_clientes)
        self.setLayout(self.layout)
Exemplo n.º 12
0
 def createTable(self, data):
     #Not proud about the following, but it serves the purpose...
     data = data.strip('][').split(',')
     self.tableWidget = QTableWidget()
     self.tableWidget.setColumnCount(3)
     self.tableWidget.setRowCount(len(data) / 3)
     self.tableWidget.setHorizontalHeaderLabels(
         ['Mood', 'Is-Positive', 'Timestamp'])
     p = 0
     for r, list in enumerate(data):
         for i in range(3):
             if p < len(data):
                 self.tableWidget.setItem(
                     r, i,
                     QTableWidgetItem(
                         re.sub('[""]', '',
                                data[p]).replace('[', '').replace(']', '')))
             p = p + 1
     self.tableWidget.show()
Exemplo n.º 13
0
    def initUI(self):
        self.setWindowTitle("QTableWidget 例子")
        self.resize(430, 230)
        conLayout = QHBoxLayout()
        tableWidget = QTableWidget()
        tableWidget.setRowCount(4)
        tableWidget.setColumnCount(3)
        conLayout.addWidget(tableWidget)

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

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

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

        newItem = QTableWidgetItem("80")
        tableWidget.setItem(0, 2, newItem)

        # 将表格变为禁止编辑
        # tableWidget.setEditTriggers(QAbstractItemView.NoEditTriggers)

        # 设置表格为整行选择
        # tableWidget.setSelectionBehavior( QAbstractItemView.SelectRows)

        # 将行和列的大小设为与内容相匹配
        # tableWidget.resizeColumnsToContents()
        # tableWidget.resizeRowsToContents()

        # 表格表头的显示与隐藏
        # tableWidget.verticalHeader().setVisible(False)
        # tableWidget.horizontalHeader().setVisible(False)

        # 不显示表格单元格的分割线
        # tableWidget.setShowGrid(False)
        # 不显示垂直表头
        tableWidget.verticalHeader().setVisible(False)

        self.setLayout(conLayout)
Exemplo n.º 14
0
    def initUI(self):
        self.setWindowTitle("QTableWidget 例子")
        self.resize(430, 230)
        conLayout = QHBoxLayout()
        tableWidget = QTableWidget()
        tableWidget.setRowCount(4)
        tableWidget.setColumnCount(3)
        conLayout.addWidget(tableWidget)

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

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

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

        newItem = QTableWidgetItem("160")
        tableWidget.setItem(0, 2, newItem)

        self.setLayout(conLayout)
Exemplo n.º 15
0
    def __init__(self, parent, onset, duration, description):
        super().__init__(parent)
        self.setWindowTitle("Edit Annotations")

        self.table = QTableWidget(len(onset), 3)

        for row, annotation in enumerate(zip(onset, duration, description)):
            self.table.setItem(row, 0, IntTableWidgetItem(annotation[0]))
            self.table.setItem(row, 1, IntTableWidgetItem(annotation[1]))
            self.table.setItem(row, 2, QTableWidgetItem(annotation[2]))

        self.table.setHorizontalHeaderLabels(["Onset", "Duration", "Type"])
        self.table.horizontalHeader().setStretchLastSection(True)
        self.table.verticalHeader().setVisible(False)
        self.table.setShowGrid(False)
        self.table.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.table.setSortingEnabled(True)
        self.table.sortByColumn(0, Qt.AscendingOrder)

        vbox = QVBoxLayout(self)
        vbox.addWidget(self.table)
        hbox = QHBoxLayout()
        self.add_button = QPushButton("+")
        self.remove_button = QPushButton("-")
        buttonbox = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)
        hbox.addWidget(self.add_button)
        hbox.addWidget(self.remove_button)
        hbox.addStretch()
        hbox.addWidget(buttonbox)
        vbox.addLayout(hbox)
        buttonbox.accepted.connect(self.accept)
        buttonbox.rejected.connect(self.reject)
        self.table.itemSelectionChanged.connect(self.toggle_buttons)
        self.remove_button.clicked.connect(self.remove_event)
        self.add_button.clicked.connect(self.add_event)
        self.toggle_buttons()
        self.resize(500, 500)
Exemplo n.º 16
0
    def initUI(self):
        self.setWindowTitle("QTableWidget 例子")
        self.resize(430, 230);
        conLayout = QHBoxLayout()
        tableWidget = QTableWidget()
        tableWidget.setRowCount(4)
        tableWidget.setColumnCount(3)
        conLayout.addWidget(tableWidget)

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

        newItem = QTableWidgetItem("张三")
        newItem.setForeground(QBrush(QColor(255, 0, 0)))
        tableWidget.setItem(0, 0, newItem)

        newItem = QTableWidgetItem("男")
        newItem.setForeground(QBrush(QColor(255, 0, 0)))
        tableWidget.setItem(0, 1, newItem)

        newItem = QTableWidgetItem("160")
        newItem.setForeground(QBrush(QColor(255, 0, 0)))
        tableWidget.setItem(0, 2, newItem)

        self.setLayout(conLayout)
Exemplo n.º 17
0
    def __init__(self, _settings: settings.Settings, parent=None):
        super(MainWindow, self).__init__(parent)

        self.formation_extrapolator_windows = []
        self.formation_list_windows = []

        self.settings = _settings

        self.stepgraph = stepgraph.Stepgraph(self)

        self.hook = hook.Hook(self)

        self.current_step_state: State = State(field_id=117,
                                               step=Step(0, 0),
                                               danger=0,
                                               step_fraction=0,
                                               formation_value=0)

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

        menubar = QMenuBar()

        menu_file = QMenu("File")

        menu_file_exit = QAction("Exit", self)
        menu_file_exit.triggered.connect(exit)
        menu_file.addAction(menu_file_exit)

        menu_connect = QMenu("Connect")

        menu_connect_connect_emulator = QAction("Connect to Emulator", self)
        menu_connect_connect_emulator.triggered.connect(self.connect_emulator)
        menu_connect.addAction(menu_connect_connect_emulator)

        menu_connect_connect_pc = QAction("Connect to PC", self)
        menu_connect_connect_pc.triggered.connect(self.connect_pc)
        menu_connect.addAction(menu_connect_connect_pc)

        menu_connect.addSeparator()

        menu_connect_disconnect = QAction("Disconnect", self)
        menu_connect_disconnect.triggered.connect(self.disconnect)
        menu_connect.addAction(menu_connect_disconnect)

        menu_window = QMenu("Window")

        menu_window_toggle_stepgraph = QAction("Toggle Stepgraph", self)
        menu_window_toggle_stepgraph.triggered.connect(self.stepgraph.toggle)
        menu_window.addAction(menu_window_toggle_stepgraph)

        menu_window_open_formation_window = QAction("Open Formation Window",
                                                    self)
        menu_window_open_formation_window.triggered.connect(
            self.open_formation_extrapolator)
        menu_window.addAction(menu_window_open_formation_window)

        menubar.addMenu(menu_file)
        menubar.addMenu(menu_connect)
        menubar.addMenu(menu_window)

        # self.master.config(menu=menubar)
        self.setMenuBar(menubar)

        main_frame = QFrame()
        layout = QVBoxLayout()

        rows = [
            "Step ID", "Step Fraction", "Offset", "Danger",
            "Formation Accumulator", "Field ID", "Table Index",
            "Danger Divisor Multiplier", "Lure Rate", "Preempt Rate",
            "Last Encounter Formation"
        ]

        self.memory_view = QTableWidget(len(rows), 2)
        self.memory_view.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.memory_view.setFocusPolicy(Qt.NoFocus)
        self.memory_view.setSelectionMode(QAbstractItemView.NoSelection)
        self.memory_view.setHorizontalHeaderItem(0,
                                                 QTableWidgetItem("Address"))
        self.memory_view.setHorizontalHeaderItem(
            1, QTableWidgetItem("        Value        "))
        self.memory_view.horizontalHeader().setSectionResizeMode(
            QHeaderView.Stretch)
        self.memory_view.verticalHeader().setSectionResizeMode(
            QHeaderView.ResizeToContents)
        for rowNum in range(len(rows)):
            self.memory_view.setVerticalHeaderItem(rowNum,
                                                   QTableWidgetItem(""))
            _l = QLabel(" " + rows[rowNum] + " ")
            _l.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
            self.memory_view.setCellWidget(rowNum, 0, _l)
            _l = QLabel("")
            _l.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
            self.memory_view.setCellWidget(rowNum, 1, _l)
        self.memory_view.resizeColumnsToContents()
        self.memory_view.setMinimumHeight(350)
        self.memory_view.setMinimumWidth(300)
        layout.addWidget(self.memory_view)

        self.connected_text = QLabel(self.settings.DISCONNECTED_TEXT)
        self.connected_text.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        layout.addWidget(self.connected_text)

        main_frame.setLayout(layout)

        self.setCentralWidget(main_frame)

        self.setMinimumHeight(420)
Exemplo n.º 18
0
    def __init__(self, base):
        QWidget.__init__(self)

        self.base = base

        self.setWindowIcon(QIcon('icon.ico'))
        self.setWindowTitle(TITLE)
        self.set_background_color(QColor(255, 255, 255))

        self.process_header_widget = QWidget()
        self.process_header_layout = QHBoxLayout(self.process_header_widget)
        self.process_header_layout.setContentsMargins(0, 0, 0, 0)

        self.process_label = QLabel('Available processes:')
        self.github_label = QLabel(
            '<a href="https://github.com/darktohka/p3dephaser">GitHub</a>')
        self.github_label.setOpenExternalLinks(True)

        self.refresh_button = QPushButton('Refresh')
        self.refresh_button.clicked.connect(self.refresh_processes)
        self.refresh_button.setFixedSize(100, 23)

        self.multifile_widget = QWidget()
        self.multifile_layout = QHBoxLayout(self.multifile_widget)
        self.multifile_layout.setContentsMargins(0, 0, 0, 0)
        self.multifileLabel = QLabel('Requested multifile names:')
        self.multifileBox = QLineEdit(self)
        self.multifileBox.returnPressed.connect(self.begin_scan)

        self.multifile_layout.addWidget(self.multifileLabel)
        self.multifile_layout.addWidget(self.multifileBox)

        self.scan_button = QPushButton('Scan')
        self.scan_button.clicked.connect(self.begin_scan)

        self.process_list_box = QListWidget()

        self.process_header_layout.addWidget(self.process_label)
        self.process_header_layout.addStretch(1)
        self.process_header_layout.addWidget(self.github_label)
        self.process_header_layout.addWidget(self.refresh_button)

        self.result_table = QTableWidget()
        self.result_table.setColumnCount(3)
        self.result_table.horizontalHeader().setStretchLastSection(True)
        self.result_table.horizontalHeader().setSectionResizeMode(
            QHeaderView.ResizeMode.Stretch)

        for i, header in enumerate(('Process', 'Multifile', 'Password')):
            self.result_table.setHorizontalHeaderItem(i,
                                                      QTableWidgetItem(header))

        self.base_layout = QVBoxLayout(self)
        self.base_layout.setContentsMargins(15, 15, 15, 15)
        self.base_layout.addWidget(self.process_header_widget)
        self.base_layout.addWidget(self.process_list_box)
        self.base_layout.addWidget(self.multifile_widget)
        self.base_layout.addWidget(self.scan_button)
        self.base_layout.addWidget(self.result_table)

        self.refresh_processes()

        self.thread_pool = QThreadPool()
        self.worker = None
        self.process_name = None
        self.stop_event = threading.Event()
Exemplo n.º 19
0
    def __init__(self):
        QMainWindow.__init__(self)
        # Variaveis
        self.separador = ";" # Separador padrao de colunas em um arquivo txt ou csv
        self.selected = np.array([1, 24, 48, 96]).astype('timedelta64[h]') # selecionados ao iniciar o programa, modificavel.
        self.fileformat =  '' # Reservado para o formato do arquivo a ser aberto. Pode ser .xlsx ou .odf. ou .csv e assim vai.

        # facilita o acesso a variavel.
        self.timedeltastr = ("1 Hora","2 Horas", "3 Horas", "4 Horas","12 Horas",
         "24 Horas", "48 Horas", "72 horas", "96 horas", "30 Dias")
        self.timedeltas = np.array([1, 2, 3, 4, 12, 24, 48, 72, 96, 24*30]).astype('timedelta64[h]')
        self.linktimedelta = dict([(self.timedeltas[x], self.timedeltastr[x]) for x in range(len(self.timedeltastr))])

        self.datastring = ["DD/MM/AAAA",'AAAA/MM/DD', "AAAA-MM-DD", "DD-MM-AAAA"]
        self.dataformat = ["%d/%m/%Y", "%Y/%m/%d", "%Y-%m-%d", "%d-%m-%Y"]
        self.linkdata = dict([(self.datastring[x], self.dataformat[x]) for x in range(len(self.dataformat))])

        self.timestring = ["hh:mm", "hh:mm:ss", "hh:mm:ss.ms"]
        self.timeformat = ["%H:%M", "%H:%M:%S", "%H:%M:%S.%f"]
        self.linktime = dict([(self.timestring[x], self.timeformat[x]) for x in range(len(self.timeformat))])

        #Janela Principal
        widget = QWidget()
        self.setCentralWidget(widget)

        # Inicializa os Widgets
        self.folder = QLineEdit("Salvar Como...")
        self.path = QLineEdit("Abrir arquivo...")
        #
        buttonOpen = QPushButton('Abrir')
        buttonSave = QPushButton("Destino")
        Processar = QPushButton('Executar')
        Ajuda = QPushButton('Informações')
        #
        groupBox2 = QGroupBox("Delimitador")
        self.delimitador1 = QRadioButton("Ponto-Vírgula")
        self.delimitador2 = QRadioButton("Vírgula")
        self.delimitador3 = QRadioButton("Ponto")
        self.delimitador4 = QRadioButton("Tabulação")
        #
        checkGroup = QGroupBox("Mais opções")
        text3 = QPushButton("Configurações")
        text2 = QLabel("Formato da Data")
        text1 = QLabel("Formato da Hora")
        self.FormatoTime = QComboBox()
        self.FormatoTime.addItems(self.timestring)
        self.FormatoData = QComboBox()
        self.FormatoData.addItems(self.datastring)
        #
        text = QLabel("Por favor, selecione na tabela abaixo as colunas a utilizar:")
        self.ignore = QRadioButton("Possui Cabeçalho") # True se estiver selecionado, False caso nao
        #
        self.Tabela = QTableWidget(15,15)
        self.startTable()

        # Layouts
        MainLayout = QVBoxLayout()

        Gridlayout = QGridLayout()
        Gridlayout.addWidget(self.path, 0, 0)
        Gridlayout.addWidget(self.folder, 1, 0)
        Gridlayout.addWidget(buttonOpen, 0, 1)
        Gridlayout.addWidget(buttonSave, 1, 1)
        Gridlayout.addWidget(Processar, 0, 3)
        Gridlayout.addWidget(Ajuda, 1, 3)
        Gridlayout.setColumnStretch(0, 2)
        Gridlayout.setColumnStretch(3, 1)
        Gridlayout.setColumnMinimumWidth(2, 20)

        SecondLayout = QHBoxLayout()
        SecondLayout.addWidget(groupBox2)
        SecondLayout.addSpacing(40)
        SecondLayout.addWidget(checkGroup)
        #
        SepLayout = QVBoxLayout()
        SepLayout.addWidget(self.delimitador1)
        SepLayout.addWidget(self.delimitador2)
        SepLayout.addWidget(self.delimitador3)
        SepLayout.addWidget(self.delimitador4)
        #
        OptionsLayout = QVBoxLayout()
        OptionsLayout.addWidget(text3)
        OptionsLayout.addWidget(text2)
        OptionsLayout.addWidget(self.FormatoData)
        OptionsLayout.addWidget(text1)
        OptionsLayout.addWidget(self.FormatoTime)

        ThirdLayout = QVBoxLayout()
        ThirdLayout.addWidget(self.ignore)
        ThirdLayout.addWidget(text)

        MainLayout.addLayout(Gridlayout)
        MainLayout.addLayout(SecondLayout)
        MainLayout.addLayout(ThirdLayout)
        MainLayout.addWidget(self.Tabela)

        # Coloca o Layout principal na Janela
        widget.setLayout(MainLayout)

        # Comandos dos Widgets e edicoes.
        groupBox2.setLayout(SepLayout)
        self.delimitador1.setChecked(True)
        self.folder.setReadOnly(True)
        self.path.setReadOnly(True)
        checkGroup.setLayout(OptionsLayout)

        buttonOpen.clicked.connect(self.searchFile)
        buttonSave.clicked.connect(self.getNewFile)
        self.delimitador1.clicked.connect(self.updateDelimiter)
        self.delimitador2.clicked.connect(self.updateDelimiter)
        self.delimitador3.clicked.connect(self.updateDelimiter)
        self.delimitador4.clicked.connect(self.updateDelimiter)
        Ajuda.clicked.connect(self.help)
        Processar.clicked.connect(self.taskStart)
        text3.clicked.connect(self.openSubWindow)

        # Propriedades da janela principal
        height = 480
        width = 640
        myappid = 'GePlu.release1_0.0' # arbitrary string
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
        self.setWindowIcon(QIcon(r'images\icon6.ico'))
        self.setFixedSize(width, height)
        self.setWindowTitle("GePlu")
Exemplo n.º 20
0
    def setupUi(self, stepData):
        if not stepData.objectName():
            stepData.setObjectName(u"stepData")
        stepData.setEnabled(True)
        stepData.setMaximumSize(QSize(410, 16777215))
        self.stepsTab = QWidget()
        self.stepsTab.setObjectName(u"stepsTab")
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.stepsTab.sizePolicy().hasHeightForWidth())
        self.stepsTab.setSizePolicy(sizePolicy)
        self.stepsTab.setMinimumSize(QSize(200, 278))
        self.stepsTab.setAutoFillBackground(False)
        self.verticalLayout_2 = QVBoxLayout(self.stepsTab)
        self.verticalLayout_2.setObjectName(u"verticalLayout_2")
        self.verticalLayout_2.setContentsMargins(-1, 11, -1, -1)
        self.stepsTable = QTableWidget(self.stepsTab)
        self.stepsTable.setObjectName(u"stepsTable")

        self.verticalLayout_2.addWidget(self.stepsTable)

        self.stepButtons = QHBoxLayout()
        self.stepButtons.setObjectName(u"stepButtons")
        self.stepDownBtn = QPushButton(self.stepsTab)
        self.stepDownBtn.setObjectName(u"stepDownBtn")

        self.stepButtons.addWidget(self.stepDownBtn)

        self.stepUpBtn = QPushButton(self.stepsTab)
        self.stepUpBtn.setObjectName(u"stepUpBtn")

        self.stepButtons.addWidget(self.stepUpBtn)

        self.removeStepBtn = QPushButton(self.stepsTab)
        self.removeStepBtn.setObjectName(u"removeStepBtn")

        self.stepButtons.addWidget(self.removeStepBtn)

        self.addStepBtn = QPushButton(self.stepsTab)
        self.addStepBtn.setObjectName(u"addStepBtn")

        self.stepButtons.addWidget(self.addStepBtn)

        self.runBtn = QPushButton(self.stepsTab)
        self.runBtn.setObjectName(u"runBtn")
        sizePolicy1 = QSizePolicy(QSizePolicy.MinimumExpanding,
                                  QSizePolicy.Fixed)
        sizePolicy1.setHorizontalStretch(0)
        sizePolicy1.setVerticalStretch(0)
        sizePolicy1.setHeightForWidth(
            self.runBtn.sizePolicy().hasHeightForWidth())
        self.runBtn.setSizePolicy(sizePolicy1)
        self.runBtn.setMinimumSize(QSize(0, 0))
        font = QFont()
        font.setBold(False)
        self.runBtn.setFont(font)
        self.runBtn.setCheckable(False)
        self.runBtn.setFlat(False)

        self.stepButtons.addWidget(self.runBtn)

        self.verticalLayout_2.addLayout(self.stepButtons)

        stepData.addTab(self.stepsTab, "")
        self.templatesTab = QWidget()
        self.templatesTab.setObjectName(u"templatesTab")
        sizePolicy2 = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Preferred)
        sizePolicy2.setHorizontalStretch(0)
        sizePolicy2.setVerticalStretch(0)
        sizePolicy2.setHeightForWidth(
            self.templatesTab.sizePolicy().hasHeightForWidth())
        self.templatesTab.setSizePolicy(sizePolicy2)
        self.verticalLayout_19 = QVBoxLayout(self.templatesTab)
        self.verticalLayout_19.setObjectName(u"verticalLayout_19")
        self.treeWidget = QTreeWidget(self.templatesTab)
        __qtreewidgetitem = QTreeWidgetItem()
        __qtreewidgetitem.setText(0, u"1")
        self.treeWidget.setHeaderItem(__qtreewidgetitem)
        self.treeWidget.setObjectName(u"treeWidget")
        sizePolicy3 = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Expanding)
        sizePolicy3.setHorizontalStretch(0)
        sizePolicy3.setVerticalStretch(0)
        sizePolicy3.setHeightForWidth(
            self.treeWidget.sizePolicy().hasHeightForWidth())
        self.treeWidget.setSizePolicy(sizePolicy3)

        self.verticalLayout_19.addWidget(self.treeWidget)

        stepData.addTab(self.templatesTab, "")
        self.optionsTab = QWidget()
        self.optionsTab.setObjectName(u"optionsTab")
        sizePolicy4 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        sizePolicy4.setHorizontalStretch(0)
        sizePolicy4.setVerticalStretch(0)
        sizePolicy4.setHeightForWidth(
            self.optionsTab.sizePolicy().hasHeightForWidth())
        self.optionsTab.setSizePolicy(sizePolicy4)
        self.optionsTab.setAutoFillBackground(True)
        self.verticalLayout_17 = QVBoxLayout(self.optionsTab)
        self.verticalLayout_17.setObjectName(u"verticalLayout_17")
        self.stepOptionsTable = QTableWidget(self.optionsTab)
        self.stepOptionsTable.setObjectName(u"stepOptionsTable")

        self.verticalLayout_17.addWidget(self.stepOptionsTable)

        stepData.addTab(self.optionsTab, "")

        self.retranslateUi(stepData)

        stepData.setCurrentIndex(2)

        QMetaObject.connectSlotsByName(stepData)
Exemplo n.º 21
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')) + '/'

        # main layout
        window_verticalLayout = QVBoxLayout(self)

        # setting_tabWidget
        self.setting_tabWidget = QTabWidget(self)

        # download_options_tab
        self.download_options_tab = QWidget()
        download_options_tab_verticalLayout = QVBoxLayout(
            self.download_options_tab)
        download_options_tab_verticalLayout.setContentsMargins(21, 21, 0, 0)

        # tries
        tries_horizontalLayout = QHBoxLayout()

        self.tries_label = QLabel(self.download_options_tab)
        tries_horizontalLayout.addWidget(self.tries_label)

        self.tries_spinBox = QSpinBox(self.download_options_tab)
        self.tries_spinBox.setMinimum(1)

        tries_horizontalLayout.addWidget(self.tries_spinBox)
        download_options_tab_verticalLayout.addLayout(tries_horizontalLayout)

        # wait
        wait_horizontalLayout = QHBoxLayout()

        self.wait_label = QLabel(self.download_options_tab)
        wait_horizontalLayout.addWidget(self.wait_label)

        self.wait_spinBox = QSpinBox(self.download_options_tab)
        wait_horizontalLayout.addWidget(self.wait_spinBox)

        download_options_tab_verticalLayout.addLayout(wait_horizontalLayout)

        # time_out
        time_out_horizontalLayout = QHBoxLayout()

        self.time_out_label = QLabel(self.download_options_tab)
        time_out_horizontalLayout.addWidget(self.time_out_label)

        self.time_out_spinBox = QSpinBox(self.download_options_tab)
        time_out_horizontalLayout.addWidget(self.time_out_spinBox)

        download_options_tab_verticalLayout.addLayout(
            time_out_horizontalLayout)

        # connections
        connections_horizontalLayout = QHBoxLayout()

        self.connections_label = QLabel(self.download_options_tab)
        connections_horizontalLayout.addWidget(self.connections_label)

        self.connections_spinBox = QSpinBox(self.download_options_tab)
        self.connections_spinBox.setMinimum(1)
        self.connections_spinBox.setMaximum(16)
        connections_horizontalLayout.addWidget(self.connections_spinBox)

        download_options_tab_verticalLayout.addLayout(
            connections_horizontalLayout)

        # rpc_port
        self.rpc_port_label = QLabel(self.download_options_tab)
        self.rpc_horizontalLayout = QHBoxLayout()
        self.rpc_horizontalLayout.addWidget(self.rpc_port_label)

        self.rpc_port_spinbox = QSpinBox(self.download_options_tab)
        self.rpc_port_spinbox.setMinimum(1024)
        self.rpc_port_spinbox.setMaximum(65535)
        self.rpc_horizontalLayout.addWidget(self.rpc_port_spinbox)

        download_options_tab_verticalLayout.addLayout(
            self.rpc_horizontalLayout)

        # wait_queue
        wait_queue_horizontalLayout = QHBoxLayout()

        self.wait_queue_label = QLabel(self.download_options_tab)
        wait_queue_horizontalLayout.addWidget(self.wait_queue_label)

        self.wait_queue_time = MyQDateTimeEdit(self.download_options_tab)
        self.wait_queue_time.setDisplayFormat('H:mm')
        wait_queue_horizontalLayout.addWidget(self.wait_queue_time)

        download_options_tab_verticalLayout.addLayout(
            wait_queue_horizontalLayout)

        # don't check certificate checkBox
        self.dont_check_certificate_checkBox = QCheckBox(
            self.download_options_tab)
        download_options_tab_verticalLayout.addWidget(
            self.dont_check_certificate_checkBox)

        # change aria2 path
        aria2_path_verticalLayout = QVBoxLayout()

        self.aria2_path_checkBox = QCheckBox(self.download_options_tab)
        aria2_path_verticalLayout.addWidget(self.aria2_path_checkBox)

        aria2_path_horizontalLayout = QHBoxLayout()

        self.aria2_path_lineEdit = QLineEdit(self.download_options_tab)
        aria2_path_horizontalLayout.addWidget(self.aria2_path_lineEdit)

        self.aria2_path_pushButton = QPushButton(self.download_options_tab)
        aria2_path_horizontalLayout.addWidget(self.aria2_path_pushButton)

        aria2_path_verticalLayout.addLayout(aria2_path_horizontalLayout)

        download_options_tab_verticalLayout.addLayout(
            aria2_path_verticalLayout)

        download_options_tab_verticalLayout.addStretch(1)

        self.setting_tabWidget.addTab(self.download_options_tab, "")

        # save_as_tab
        self.save_as_tab = QWidget()

        save_as_tab_verticalLayout = QVBoxLayout(self.save_as_tab)
        save_as_tab_verticalLayout.setContentsMargins(20, 30, 0, 0)

        # download_folder
        self.download_folder_horizontalLayout = QHBoxLayout()

        self.download_folder_label = QLabel(self.save_as_tab)
        self.download_folder_horizontalLayout.addWidget(
            self.download_folder_label)

        self.download_folder_lineEdit = QLineEdit(self.save_as_tab)
        self.download_folder_horizontalLayout.addWidget(
            self.download_folder_lineEdit)

        self.download_folder_pushButton = QPushButton(self.save_as_tab)
        self.download_folder_horizontalLayout.addWidget(
            self.download_folder_pushButton)

        save_as_tab_verticalLayout.addLayout(
            self.download_folder_horizontalLayout)

        # temp_download_folder
        self.temp_horizontalLayout = QHBoxLayout()

        self.temp_download_label = QLabel(self.save_as_tab)
        self.temp_horizontalLayout.addWidget(self.temp_download_label)

        self.temp_download_lineEdit = QLineEdit(self.save_as_tab)
        self.temp_horizontalLayout.addWidget(self.temp_download_lineEdit)

        self.temp_download_pushButton = QPushButton(self.save_as_tab)
        self.temp_horizontalLayout.addWidget(self.temp_download_pushButton)

        save_as_tab_verticalLayout.addLayout(self.temp_horizontalLayout)

        # create subfolder
        self.subfolder_checkBox = QCheckBox(self.save_as_tab)
        save_as_tab_verticalLayout.addWidget(self.subfolder_checkBox)

        save_as_tab_verticalLayout.addStretch(1)

        self.setting_tabWidget.addTab(self.save_as_tab, "")

        # notifications_tab
        self.notifications_tab = QWidget()
        notification_tab_verticalLayout = QVBoxLayout(self.notifications_tab)
        notification_tab_verticalLayout.setContentsMargins(21, 21, 0, 0)

        self.enable_notifications_checkBox = QCheckBox(self.notifications_tab)
        notification_tab_verticalLayout.addWidget(
            self.enable_notifications_checkBox)

        self.sound_frame = QFrame(self.notifications_tab)
        self.sound_frame.setFrameShape(QFrame.StyledPanel)
        self.sound_frame.setFrameShadow(QFrame.Raised)

        verticalLayout = QVBoxLayout(self.sound_frame)

        self.volume_label = QLabel(self.sound_frame)
        verticalLayout.addWidget(self.volume_label)

        self.volume_dial = QDial(self.sound_frame)
        self.volume_dial.setProperty("value", 100)
        verticalLayout.addWidget(self.volume_dial)

        notification_tab_verticalLayout.addWidget(self.sound_frame)

        # message_notification
        message_notification_horizontalLayout = QHBoxLayout()
        self.notification_label = QLabel(self.notifications_tab)
        message_notification_horizontalLayout.addWidget(
            self.notification_label)

        self.notification_comboBox = QComboBox(self.notifications_tab)
        message_notification_horizontalLayout.addWidget(
            self.notification_comboBox)
        notification_tab_verticalLayout.addLayout(
            message_notification_horizontalLayout)

        notification_tab_verticalLayout.addStretch(1)

        self.setting_tabWidget.addTab(self.notifications_tab, "")

        # style_tab
        self.style_tab = QWidget()
        style_tab_verticalLayout = QVBoxLayout(self.style_tab)
        style_tab_verticalLayout.setContentsMargins(21, 21, 0, 0)

        # style
        style_horizontalLayout = QHBoxLayout()

        self.style_label = QLabel(self.style_tab)
        style_horizontalLayout.addWidget(self.style_label)

        self.style_comboBox = QComboBox(self.style_tab)
        style_horizontalLayout.addWidget(self.style_comboBox)

        style_tab_verticalLayout.addLayout(style_horizontalLayout)

        # language
        language_horizontalLayout = QHBoxLayout()

        self.lang_label = QLabel(self.style_tab)
        language_horizontalLayout.addWidget(self.lang_label)
        self.lang_comboBox = QComboBox(self.style_tab)
        language_horizontalLayout.addWidget(self.lang_comboBox)

        style_tab_verticalLayout.addLayout(language_horizontalLayout)
        language_horizontalLayout = QHBoxLayout()
        self.lang_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Language: "))

        # color scheme
        self.color_label = QLabel(self.style_tab)
        language_horizontalLayout.addWidget(self.color_label)

        self.color_comboBox = QComboBox(self.style_tab)
        language_horizontalLayout.addWidget(self.color_comboBox)

        style_tab_verticalLayout.addLayout(language_horizontalLayout)

        # icons
        icons_horizontalLayout = QHBoxLayout()
        self.icon_label = QLabel(self.style_tab)
        icons_horizontalLayout.addWidget(self.icon_label)

        self.icon_comboBox = QComboBox(self.style_tab)
        icons_horizontalLayout.addWidget(self.icon_comboBox)

        style_tab_verticalLayout.addLayout(icons_horizontalLayout)

        self.icons_size_horizontalLayout = QHBoxLayout()
        self.icons_size_label = QLabel(self.style_tab)
        self.icons_size_horizontalLayout.addWidget(self.icons_size_label)

        self.icons_size_comboBox = QComboBox(self.style_tab)
        self.icons_size_horizontalLayout.addWidget(self.icons_size_comboBox)

        style_tab_verticalLayout.addLayout(self.icons_size_horizontalLayout)

        # font
        font_horizontalLayout = QHBoxLayout()
        self.font_checkBox = QCheckBox(self.style_tab)
        font_horizontalLayout.addWidget(self.font_checkBox)

        self.fontComboBox = QFontComboBox(self.style_tab)
        font_horizontalLayout.addWidget(self.fontComboBox)

        self.font_size_label = QLabel(self.style_tab)
        font_horizontalLayout.addWidget(self.font_size_label)

        self.font_size_spinBox = QSpinBox(self.style_tab)
        self.font_size_spinBox.setMinimum(1)
        font_horizontalLayout.addWidget(self.font_size_spinBox)

        style_tab_verticalLayout.addLayout(font_horizontalLayout)
        self.setting_tabWidget.addTab(self.style_tab, "")
        window_verticalLayout.addWidget(self.setting_tabWidget)

        # start persepolis in system tray if browser executed
        self.start_persepolis_if_browser_executed_checkBox = QCheckBox(
            self.style_tab)
        style_tab_verticalLayout.addWidget(
            self.start_persepolis_if_browser_executed_checkBox)

        # hide window if close button clicked
        self.hide_window_checkBox = QCheckBox(self.style_tab)
        style_tab_verticalLayout.addWidget(self.hide_window_checkBox)

        # Enable system tray icon
        self.enable_system_tray_checkBox = QCheckBox(self.style_tab)
        style_tab_verticalLayout.addWidget(self.enable_system_tray_checkBox)

        # after_download dialog
        self.after_download_checkBox = QCheckBox()
        style_tab_verticalLayout.addWidget(self.after_download_checkBox)

        # show_menubar_checkbox
        self.show_menubar_checkbox = QCheckBox()
        style_tab_verticalLayout.addWidget(self.show_menubar_checkbox)

        # show_sidepanel_checkbox
        self.show_sidepanel_checkbox = QCheckBox()
        style_tab_verticalLayout.addWidget(self.show_sidepanel_checkbox)

        # hide progress window
        self.show_progress_window_checkbox = QCheckBox()
        style_tab_verticalLayout.addWidget(self.show_progress_window_checkbox)

        # add persepolis to startup
        self.startup_checkbox = QCheckBox()
        style_tab_verticalLayout.addWidget(self.startup_checkbox)

        # keep system awake
        self.keep_awake_checkBox = QCheckBox()
        style_tab_verticalLayout.addWidget(self.keep_awake_checkBox)

        style_tab_verticalLayout.addStretch(1)

        # columns_tab
        self.columns_tab = QWidget()

        columns_tab_verticalLayout = QVBoxLayout(self.columns_tab)
        columns_tab_verticalLayout.setContentsMargins(21, 21, 0, 0)

        # creating checkBox for columns
        self.show_column_label = QLabel()
        self.column0_checkBox = QCheckBox()
        self.column1_checkBox = QCheckBox()
        self.column2_checkBox = QCheckBox()
        self.column3_checkBox = QCheckBox()
        self.column4_checkBox = QCheckBox()
        self.column5_checkBox = QCheckBox()
        self.column6_checkBox = QCheckBox()
        self.column7_checkBox = QCheckBox()
        self.column10_checkBox = QCheckBox()
        self.column11_checkBox = QCheckBox()
        self.column12_checkBox = QCheckBox()

        columns_tab_verticalLayout.addWidget(self.show_column_label)
        columns_tab_verticalLayout.addWidget(self.column0_checkBox)
        columns_tab_verticalLayout.addWidget(self.column1_checkBox)
        columns_tab_verticalLayout.addWidget(self.column2_checkBox)
        columns_tab_verticalLayout.addWidget(self.column3_checkBox)
        columns_tab_verticalLayout.addWidget(self.column4_checkBox)
        columns_tab_verticalLayout.addWidget(self.column5_checkBox)
        columns_tab_verticalLayout.addWidget(self.column6_checkBox)
        columns_tab_verticalLayout.addWidget(self.column7_checkBox)
        columns_tab_verticalLayout.addWidget(self.column10_checkBox)
        columns_tab_verticalLayout.addWidget(self.column11_checkBox)
        columns_tab_verticalLayout.addWidget(self.column12_checkBox)

        columns_tab_verticalLayout.addStretch(1)

        self.setting_tabWidget.addTab(self.columns_tab, '')

        # video_finder_tab
        self.video_finder_tab = QWidget()

        video_finder_layout = QVBoxLayout(self.video_finder_tab)
        video_finder_layout.setContentsMargins(21, 21, 0, 0)

        video_finder_tab_verticalLayout = QVBoxLayout()

        max_links_horizontalLayout = QHBoxLayout()

        # max_links_label
        self.max_links_label = QLabel(self.video_finder_tab)

        max_links_horizontalLayout.addWidget(self.max_links_label)

        # max_links_spinBox
        self.max_links_spinBox = QSpinBox(self.video_finder_tab)
        self.max_links_spinBox.setMinimum(1)
        self.max_links_spinBox.setMaximum(16)
        max_links_horizontalLayout.addWidget(self.max_links_spinBox)
        video_finder_tab_verticalLayout.addLayout(max_links_horizontalLayout)

        self.video_finder_dl_path_horizontalLayout = QHBoxLayout()

        self.video_finder_frame = QFrame(self.video_finder_tab)
        self.video_finder_frame.setLayout(video_finder_tab_verticalLayout)

        video_finder_tab_verticalLayout.addStretch(1)

        video_finder_layout.addWidget(self.video_finder_frame)

        self.setting_tabWidget.addTab(self.video_finder_tab, "")

        # shortcut tab
        self.shortcut_tab = QWidget()
        shortcut_tab_verticalLayout = QVBoxLayout(self.shortcut_tab)
        shortcut_tab_verticalLayout.setContentsMargins(21, 21, 0, 0)

        # shortcut_table
        self.shortcut_table = QTableWidget(self)
        self.shortcut_table.setColumnCount(2)
        self.shortcut_table.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.shortcut_table.setSelectionMode(QAbstractItemView.SingleSelection)
        self.shortcut_table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.shortcut_table.verticalHeader().hide()

        shortcut_table_header = [
            QCoreApplication.translate("setting_ui_tr", 'Action'),
            QCoreApplication.translate("setting_ui_tr", 'Shortcut')
        ]

        self.shortcut_table.setHorizontalHeaderLabels(shortcut_table_header)

        shortcut_tab_verticalLayout.addWidget(self.shortcut_table)

        self.setting_tabWidget.addTab(
            self.shortcut_tab,
            QCoreApplication.translate("setting_ui_tr", "Shortcuts"))

        # Actions
        actions_list = [
            QCoreApplication.translate('setting_ui_tr', 'Quit'),
            QCoreApplication.translate('setting_ui_tr',
                                       'Minimize to System Tray'),
            QCoreApplication.translate('setting_ui_tr',
                                       'Remove Download Items'),
            QCoreApplication.translate('setting_ui_tr',
                                       'Delete Download Items'),
            QCoreApplication.translate('setting_ui_tr',
                                       'Move Selected Items Up'),
            QCoreApplication.translate('setting_ui_tr',
                                       'Move Selected Items Down'),
            QCoreApplication.translate('setting_ui_tr',
                                       'Add New Download Link'),
            QCoreApplication.translate('setting_ui_tr', 'Add New Video Link'),
            QCoreApplication.translate('setting_ui_tr',
                                       'Import Links from Text File')
        ]

        # add actions to the shortcut_table
        j = 0
        for action in actions_list:
            item = QTableWidgetItem(str(action))

            # align center
            item.setTextAlignment(0x0004 | 0x0080)

            # insert item in shortcut_table
            self.shortcut_table.insertRow(j)
            self.shortcut_table.setItem(j, 0, item)

            j = j + 1

        self.shortcut_table.resizeColumnsToContents()

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

        self.defaults_pushButton = QPushButton(self)
        buttons_horizontalLayout.addWidget(self.defaults_pushButton)

        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)

        # set style_tab for default
        self.setting_tabWidget.setCurrentIndex(3)

        # labels and translations
        self.setWindowTitle(
            QCoreApplication.translate("setting_ui_tr", "Preferences"))

        self.tries_label.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Set number of tries if download failed.</p></body></html>"
            ))
        self.tries_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Number of tries: "))
        self.tries_spinBox.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Set number of tries if download failed.</p></body></html>"
            ))

        self.wait_label.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Set the seconds to wait between retries. Download manager will  retry  downloads  when  the  HTTP  server  returns  a  503 response.</p></body></html>"
            ))
        self.wait_label.setText(
            QCoreApplication.translate(
                "setting_ui_tr", "Wait period between retries (seconds): "))
        self.wait_spinBox.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Set the seconds to wait between retries. Download manager will  retry  downloads  when  the  HTTP  server  returns  a  503 response.</p></body></html>"
            ))

        self.time_out_label.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Set timeout in seconds. </p></body></html>"
            ))
        self.time_out_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Timeout (seconds): "))
        self.time_out_spinBox.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Set timeout in seconds. </p></body></html>"
            ))

        self.connections_label.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Using multiple connections can help speed up your download.</p></body></html>"
            ))
        self.connections_label.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Number of connections: "))
        self.connections_spinBox.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Using multiple connections can help speed up your download.</p></body></html>"
            ))

        self.rpc_port_label.setText(
            QCoreApplication.translate("setting_ui_tr", "RPC port number: "))
        self.rpc_port_spinbox.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p> Specify a port number for JSON-RPC/XML-RPC server to listen to. Possible Values: 1024 - 65535 Default: 6801 </p></body></html>"
            ))

        self.wait_queue_label.setText(
            QCoreApplication.translate(
                "setting_ui_tr",
                'Wait period between each download in queue:'))

        self.dont_check_certificate_checkBox.setText(
            QCoreApplication.translate(
                "setting_ui_tr", "Don't use certificate to verify the peers"))
        self.dont_check_certificate_checkBox.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>This option avoids SSL/TLS handshake failure. But use it at your own risk!</p></body></html>"
            ))

        self.aria2_path_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       'Change Aria2 default path'))
        self.aria2_path_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", 'Change'))
        aria2_path_tooltip = QCoreApplication.translate(
            "setting_ui_tr",
            "<html><head/><body><p>Attention: Wrong path may cause problems! Do it carefully or don't change default setting!</p></body></html>"
        )
        self.aria2_path_checkBox.setToolTip(aria2_path_tooltip)
        self.aria2_path_lineEdit.setToolTip(aria2_path_tooltip)
        self.aria2_path_pushButton.setToolTip(aria2_path_tooltip)

        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.download_options_tab),
            QCoreApplication.translate("setting_ui_tr", "Download Options"))

        self.download_folder_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Download folder: "))
        self.download_folder_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", "Change"))

        self.temp_download_label.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Temporary download folder: "))
        self.temp_download_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", "Change"))

        self.subfolder_checkBox.setText(
            QCoreApplication.translate(
                "setting_ui_tr",
                "Create subfolders for Music,Videos, ... in default download folder"
            ))

        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.save_as_tab),
            QCoreApplication.translate("setting_ui_tr", "Save As"))

        self.enable_notifications_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Enable Notification Sounds"))

        self.volume_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Volume: "))

        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.notifications_tab),
            QCoreApplication.translate("setting_ui_tr", "Notifications"))

        self.style_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Style: "))
        self.color_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Color scheme: "))
        self.icon_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Icons: "))

        self.icons_size_label.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Toolbar icons size: "))

        self.notification_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Notification type: "))

        self.font_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", "Font: "))
        self.font_size_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Size: "))

        self.hide_window_checkBox.setText(
            QCoreApplication.translate(
                "setting_ui_tr", "Hide main window if close button clicked."))
        self.hide_window_checkBox.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>This feature may not work in your operating system.</p></body></html>"
            ))

        self.start_persepolis_if_browser_executed_checkBox.setText(
            QCoreApplication.translate(
                'setting_ui_tr',
                'If browser is opened, start Persepolis in system tray'))

        self.enable_system_tray_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Enable system tray icon"))

        self.after_download_checkBox.setText(
            QCoreApplication.translate(
                "setting_ui_tr",
                "Show download complete dialog when download is finished"))

        self.show_menubar_checkbox.setText(
            QCoreApplication.translate("setting_ui_tr", "Show menubar"))
        self.show_sidepanel_checkbox.setText(
            QCoreApplication.translate("setting_ui_tr", "Show side panel"))
        self.show_progress_window_checkbox.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Show download progress window"))

        self.startup_checkbox.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Run Persepolis at startup"))

        self.keep_awake_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", "Keep system awake!"))
        self.keep_awake_checkBox.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>This option will prevent the system from going to sleep.\
            It is necessary if your power manager is suspending the system automatically. </p></body></html>"
            ))

        self.wait_queue_time.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Format HH:MM</p></body></html>"))

        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.style_tab),
            QCoreApplication.translate("setting_ui_tr", "Preferences"))

        # columns_tab
        self.show_column_label.setText(
            QCoreApplication.translate("setting_ui_tr", 'Show these columns:'))
        self.column0_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'File Name'))
        self.column1_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Status'))
        self.column2_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Size'))
        self.column3_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Downloaded'))
        self.column4_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Percentage'))
        self.column5_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Connections'))
        self.column6_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Transfer Rate'))
        self.column7_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Estimated Time Left'))
        self.column10_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'First Try Date'))
        self.column11_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Last Try Date'))
        self.column12_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Category'))

        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.columns_tab),
            QCoreApplication.translate("setting_ui_tr",
                                       "Columns Customization"))

        # Video Finder options tab
        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.video_finder_tab),
            QCoreApplication.translate("setting_ui_tr",
                                       "Video Finder Options"))

        self.max_links_label.setText(
            QCoreApplication.translate(
                "setting_ui_tr", 'Maximum number of links to capture:<br/>'
                '<small>(If browser sends multiple video links at a time)</small>'
            ))

        # window buttons
        self.defaults_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", "Defaults"))
        self.cancel_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", "Cancel"))
        self.ok_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", "OK"))
Exemplo n.º 22
0
    def setupUi(self, MainWindow):
        if not MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.resize(514, 693)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(u"centralwidget")
        self.gridLayout = QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName(u"gridLayout")
        self.pushButton = QPushButton(self.centralwidget)
        self.pushButton.setObjectName(u"pushButton")
        self.pushButton.setCursor(QCursor(Qt.PointingHandCursor))

        self.gridLayout.addWidget(self.pushButton, 0, 1, 1, 1)

        self.tabWidget = QTabWidget(self.centralwidget)
        self.tabWidget.setObjectName(u"tabWidget")
        self.tabWidget.setStyleSheet(u"")
        self.tab = QWidget()
        self.tab.setObjectName(u"tab")
        self.gridLayout_2 = QGridLayout(self.tab)
        self.gridLayout_2.setObjectName(u"gridLayout_2")
        self.tableWidget = QTableWidget(self.tab)
        if (self.tableWidget.columnCount() < 3):
            self.tableWidget.setColumnCount(3)
        __qtablewidgetitem = QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(0, __qtablewidgetitem)
        __qtablewidgetitem1 = QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(1, __qtablewidgetitem1)
        __qtablewidgetitem2 = QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(2, __qtablewidgetitem2)
        self.tableWidget.setObjectName(u"tableWidget")
        self.tableWidget.setStyleSheet(u"")
        self.tableWidget.horizontalHeader().setCascadingSectionResizes(False)
        self.tableWidget.verticalHeader().setVisible(False)

        self.gridLayout_2.addWidget(self.tableWidget, 0, 0, 1, 1)

        self.tabWidget.addTab(self.tab, "")
        self.tab_2 = QWidget()
        self.tab_2.setObjectName(u"tab_2")
        self.gridLayout_3 = QGridLayout(self.tab_2)
        self.gridLayout_3.setObjectName(u"gridLayout_3")
        self.tableWidget_2 = QTableWidget(self.tab_2)
        self.tableWidget_2.setObjectName(u"tableWidget_2")

        self.gridLayout_3.addWidget(self.tableWidget_2, 0, 0, 1, 1)

        self.tabWidget.addTab(self.tab_2, "")

        self.gridLayout.addWidget(self.tabWidget, 1, 0, 1, 2)

        self.lineEdit = QLineEdit(self.centralwidget)
        self.lineEdit.setObjectName(u"lineEdit")
        self.lineEdit.setReadOnly(True)

        self.gridLayout.addWidget(self.lineEdit, 0, 0, 1, 1)

        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setObjectName(u"menubar")
        self.menubar.setGeometry(QRect(0, 0, 514, 22))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName(u"statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)

        self.tabWidget.setCurrentIndex(0)

        QMetaObject.connectSlotsByName(MainWindow)
Exemplo n.º 23
0
    def __init__(self,
                 parent: Optional[QWidget] = None,
                 url: str = '') -> None:
        super().__init__(parent, )

        if parent:
            self.setWindowTitle('Download Mod')
        else:
            self.setWindowTitle(getTitleString('Download Mod'))
            self.setAttribute(Qt.WA_DeleteOnClose)

        mainLayout = QVBoxLayout(self)
        mainLayout.setContentsMargins(5, 5, 5, 5)

        self.signals = DownloadWindowEvents(self)

        # URL input

        gbUrl = QGroupBox('Mod URL')
        gbUrlLayout = QVBoxLayout()
        gbUrl.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)

        self.url = QLineEdit()
        self.url.setPlaceholderText(
            'https://www.nexusmods.com/witcher3/mods/...')
        self.url.setText(url)
        self.url.textChanged.connect(lambda: self.validateUrl(self.url.text()))
        gbUrlLayout.addWidget(self.url)

        self.urlInfo = QLabel('🌐')
        self.urlInfo.setContentsMargins(4, 4, 4, 4)
        self.urlInfo.setMinimumHeight(36)
        self.urlInfo.setWordWrap(True)
        gbUrlLayout.addWidget(self.urlInfo)

        gbUrl.setLayout(gbUrlLayout)
        mainLayout.addWidget(gbUrl)

        # File selection

        gbFiles = QGroupBox('Mod Files')
        gbFilesLayout = QVBoxLayout()
        gbFiles.setSizePolicy(QSizePolicy.MinimumExpanding,
                              QSizePolicy.MinimumExpanding)

        self.files = QTableWidget(0, 4)
        self.files.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel)
        self.files.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)
        self.files.setContextMenuPolicy(Qt.CustomContextMenu)
        self.files.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.files.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.files.setWordWrap(False)
        self.files.setSortingEnabled(True)
        self.files.setFocusPolicy(Qt.StrongFocus)
        self.files.verticalHeader().hide()
        self.files.setSortingEnabled(True)
        self.files.sortByColumn(2, Qt.DescendingOrder)
        self.files.verticalHeader().setVisible(False)
        self.files.verticalHeader().setDefaultSectionSize(25)
        self.files.horizontalHeader().setHighlightSections(False)
        self.files.horizontalHeader().setStretchLastSection(True)
        self.files.setHorizontalHeaderLabels(
            ['File Name', 'Version', 'Upload Date', 'Description'])
        self.files.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.files.verticalScrollBar().valueChanged.connect(
            lambda: self.files.clearFocus())
        self.files.itemSelectionChanged.connect(lambda: self.validateFiles())
        self.files.setDisabled(True)
        self.files.setStyleSheet('''
            QTableView {
                gridline-color: rgba(255,255,255,1);
            }
            QTableView::item {
                padding: 5px;
                margin: 1px 0;
            }
            QTableView::item:!selected:hover {
                background-color: rgb(217, 235, 249);
                padding: 0;
            }
            ''')
        gbFilesLayout.addWidget(self.files)

        _mouseMoveEvent = self.files.mouseMoveEvent
        self.files.hoverIndexRow = -1

        def mouseMoveEvent(event: QMouseEvent) -> None:
            self.files.hoverIndexRow = self.files.indexAt(event.pos()).row()
            _mouseMoveEvent(event)

        self.files.mouseMoveEvent = mouseMoveEvent  # type: ignore
        self.files.setItemDelegate(ModListItemDelegate(self.files))
        self.files.setMouseTracking(True)

        gbFiles.setLayout(gbFilesLayout)
        mainLayout.addWidget(gbFiles)

        # Actions

        actionsLayout = QHBoxLayout()
        actionsLayout.setAlignment(Qt.AlignRight)
        self.download = QPushButton('Download', self)
        self.download.clicked.connect(lambda: self.downloadEvent())
        self.download.setAutoDefault(True)
        self.download.setDefault(True)
        self.download.setDisabled(True)
        actionsLayout.addWidget(self.download)
        cancel = QPushButton('Cancel', self)
        cancel.clicked.connect(self.cancelEvent)
        actionsLayout.addWidget(cancel)
        mainLayout.addLayout(actionsLayout)

        # Setup

        self.setMinimumSize(QSize(420, 420))
        self.setSizePolicy(QSizePolicy.MinimumExpanding,
                           QSizePolicy.MinimumExpanding)
        self.resize(QSize(720, 420))

        self.finished.connect(
            lambda: self.validateUrl.cancel())  # type: ignore
        self.finished.connect(
            lambda: self.downloadEvent.cancel())  # type: ignore

        self.modId = 0
        self.validateUrl(self.url.text())
Exemplo n.º 24
0
    def setupUi(self, MainWindow):
        if not MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.resize(911, 607)
        self.action_open = QAction(MainWindow)
        self.action_open.setObjectName(u"action_open")
        self.action_open.setVisible(False)
        self.action_comparison = QAction(MainWindow)
        self.action_comparison.setObjectName(u"action_comparison")
        self.action_comparison.setVisible(False)
        self.action_plot = QAction(MainWindow)
        self.action_plot.setObjectName(u"action_plot")
        self.action_training_session = QAction(MainWindow)
        self.action_training_session.setObjectName(u"action_training_session")
        self.action_training_session.setVisible(False)
        self.action_game = QAction(MainWindow)
        self.action_game.setObjectName(u"action_game")
        self.action_save = QAction(MainWindow)
        self.action_save.setObjectName(u"action_save")
        self.action_save.setVisible(False)
        self.action_save_log = QAction(MainWindow)
        self.action_save_log.setObjectName(u"action_save_log")
        self.action_save_log.setVisible(False)
        self.action_coordinates = QAction(MainWindow)
        self.action_coordinates.setObjectName(u"action_coordinates")
        self.action_coordinates.setCheckable(True)
        self.action_about = QAction(MainWindow)
        self.action_about.setObjectName(u"action_about")
        self.action_new_db = QAction(MainWindow)
        self.action_new_db.setObjectName(u"action_new_db")
        self.action_open_db = QAction(MainWindow)
        self.action_open_db.setObjectName(u"action_open_db")
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(u"centralwidget")
        self.verticalLayout_2 = QVBoxLayout(self.centralwidget)
        self.verticalLayout_2.setObjectName(u"verticalLayout_2")
        self.stacked_widget = QStackedWidget(self.centralwidget)
        self.stacked_widget.setObjectName(u"stacked_widget")
        self.game_page = QWidget()
        self.game_page.setObjectName(u"game_page")
        self.gridLayout_3 = QGridLayout(self.game_page)
        self.gridLayout_3.setObjectName(u"gridLayout_3")
        self.connect4 = QPushButton(self.game_page)
        self.connect4.setObjectName(u"connect4")
        sizePolicy = QSizePolicy(QSizePolicy.Minimum,
                                 QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.connect4.sizePolicy().hasHeightForWidth())
        self.connect4.setSizePolicy(sizePolicy)

        self.gridLayout_3.addWidget(self.connect4, 0, 1, 1, 1)

        self.tic_tac_toe = QPushButton(self.game_page)
        self.tic_tac_toe.setObjectName(u"tic_tac_toe")
        sizePolicy1 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
        sizePolicy1.setHorizontalStretch(0)
        sizePolicy1.setVerticalStretch(0)
        sizePolicy1.setHeightForWidth(
            self.tic_tac_toe.sizePolicy().hasHeightForWidth())
        self.tic_tac_toe.setSizePolicy(sizePolicy1)

        self.gridLayout_3.addWidget(self.tic_tac_toe, 0, 0, 1, 1)

        self.othello = QPushButton(self.game_page)
        self.othello.setObjectName(u"othello")
        sizePolicy.setHeightForWidth(
            self.othello.sizePolicy().hasHeightForWidth())
        self.othello.setSizePolicy(sizePolicy)

        self.gridLayout_3.addWidget(self.othello, 1, 0, 1, 1)

        self.stacked_widget.addWidget(self.game_page)
        self.players_page = QWidget()
        self.players_page.setObjectName(u"players_page")
        self.verticalLayout = QVBoxLayout(self.players_page)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.player_layout = QGridLayout()
        self.player_layout.setObjectName(u"player_layout")
        self.searches_lock2 = QCheckBox(self.players_page)
        self.searches_lock2.setObjectName(u"searches_lock2")

        self.player_layout.addWidget(self.searches_lock2, 2, 4, 1, 1)

        self.player1 = QComboBox(self.players_page)
        self.player1.setObjectName(u"player1")
        sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy2.setHorizontalStretch(0)
        sizePolicy2.setVerticalStretch(0)
        sizePolicy2.setHeightForWidth(
            self.player1.sizePolicy().hasHeightForWidth())
        self.player1.setSizePolicy(sizePolicy2)

        self.player_layout.addWidget(self.player1, 1, 1, 1, 1)

        self.cancel = QPushButton(self.players_page)
        self.cancel.setObjectName(u"cancel")

        self.player_layout.addWidget(self.cancel, 4, 0, 1, 1)

        self.searches_label1 = QLabel(self.players_page)
        self.searches_label1.setObjectName(u"searches_label1")
        sizePolicy3 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
        sizePolicy3.setHorizontalStretch(0)
        sizePolicy3.setVerticalStretch(0)
        sizePolicy3.setHeightForWidth(
            self.searches_label1.sizePolicy().hasHeightForWidth())
        self.searches_label1.setSizePolicy(sizePolicy3)

        self.player_layout.addWidget(self.searches_label1, 1, 3, 1, 1)

        self.player2 = QComboBox(self.players_page)
        self.player2.setObjectName(u"player2")
        sizePolicy2.setHeightForWidth(
            self.player2.sizePolicy().hasHeightForWidth())
        self.player2.setSizePolicy(sizePolicy2)

        self.player_layout.addWidget(self.player2, 2, 1, 1, 1)

        self.searches_lock1 = QCheckBox(self.players_page)
        self.searches_lock1.setObjectName(u"searches_lock1")

        self.player_layout.addWidget(self.searches_lock1, 1, 4, 1, 1)

        self.game_label = QLabel(self.players_page)
        self.game_label.setObjectName(u"game_label")
        sizePolicy4 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy4.setHorizontalStretch(0)
        sizePolicy4.setVerticalStretch(0)
        sizePolicy4.setHeightForWidth(
            self.game_label.sizePolicy().hasHeightForWidth())
        self.game_label.setSizePolicy(sizePolicy4)

        self.player_layout.addWidget(self.game_label, 0, 0, 1, 1)

        self.game_name = QLabel(self.players_page)
        self.game_name.setObjectName(u"game_name")

        self.player_layout.addWidget(self.game_name, 0, 1, 1, 4)

        self.searches_label2 = QLabel(self.players_page)
        self.searches_label2.setObjectName(u"searches_label2")

        self.player_layout.addWidget(self.searches_label2, 2, 3, 1, 1)

        self.player_label1 = QLabel(self.players_page)
        self.player_label1.setObjectName(u"player_label1")
        sizePolicy4.setHeightForWidth(
            self.player_label1.sizePolicy().hasHeightForWidth())
        self.player_label1.setSizePolicy(sizePolicy4)

        self.player_layout.addWidget(self.player_label1, 1, 0, 1, 1)

        self.searches1 = QSpinBox(self.players_page)
        self.searches1.setObjectName(u"searches1")
        sizePolicy5 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        sizePolicy5.setHorizontalStretch(0)
        sizePolicy5.setVerticalStretch(0)
        sizePolicy5.setHeightForWidth(
            self.searches1.sizePolicy().hasHeightForWidth())
        self.searches1.setSizePolicy(sizePolicy5)
        self.searches1.setMaximum(1000000)

        self.player_layout.addWidget(self.searches1, 1, 2, 1, 1)

        self.player_label2 = QLabel(self.players_page)
        self.player_label2.setObjectName(u"player_label2")

        self.player_layout.addWidget(self.player_label2, 2, 0, 1, 1)

        self.shuffle_players = QCheckBox(self.players_page)
        self.shuffle_players.setObjectName(u"shuffle_players")

        self.player_layout.addWidget(self.shuffle_players, 3, 1, 1, 4)

        self.searches2 = QSpinBox(self.players_page)
        self.searches2.setObjectName(u"searches2")
        sizePolicy5.setHeightForWidth(
            self.searches2.sizePolicy().hasHeightForWidth())
        self.searches2.setSizePolicy(sizePolicy5)
        self.searches2.setMaximum(1000000)

        self.player_layout.addWidget(self.searches2, 2, 2, 1, 1)

        self.start = QPushButton(self.players_page)
        self.start.setObjectName(u"start")

        self.player_layout.addWidget(self.start, 4, 1, 1, 4)

        self.player_layout.setColumnStretch(1, 10)
        self.player_layout.setColumnStretch(2, 1)

        self.verticalLayout.addLayout(self.player_layout)

        self.stacked_widget.addWidget(self.players_page)
        self.humans_page = QWidget()
        self.humans_page.setObjectName(u"humans_page")
        self.gridLayout = QGridLayout(self.humans_page)
        self.gridLayout.setObjectName(u"gridLayout")
        self.close_humans = QPushButton(self.humans_page)
        self.close_humans.setObjectName(u"close_humans")
        sizePolicy4.setHeightForWidth(
            self.close_humans.sizePolicy().hasHeightForWidth())
        self.close_humans.setSizePolicy(sizePolicy4)

        self.gridLayout.addWidget(self.close_humans, 1, 1, 1, 1)

        self.players_label = QLabel(self.humans_page)
        self.players_label.setObjectName(u"players_label")

        self.gridLayout.addWidget(self.players_label, 0, 0, 1, 1)

        self.new_human = QPushButton(self.humans_page)
        self.new_human.setObjectName(u"new_human")
        sizePolicy4.setHeightForWidth(
            self.new_human.sizePolicy().hasHeightForWidth())
        self.new_human.setSizePolicy(sizePolicy4)

        self.gridLayout.addWidget(self.new_human, 1, 3, 1, 1)

        self.players_table = QTableWidget(self.humans_page)
        self.players_table.setObjectName(u"players_table")

        self.gridLayout.addWidget(self.players_table, 0, 1, 1, 3)

        self.spacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                  QSizePolicy.Minimum)

        self.gridLayout.addItem(self.spacer, 1, 2, 1, 1)

        self.stacked_widget.addWidget(self.humans_page)
        self.rules_page = QWidget()
        self.rules_page.setObjectName(u"rules_page")
        self.gridLayout_4 = QGridLayout(self.rules_page)
        self.gridLayout_4.setObjectName(u"gridLayout_4")
        self.rules_text = QTextBrowser(self.rules_page)
        self.rules_text.setObjectName(u"rules_text")

        self.gridLayout_4.addWidget(self.rules_text, 0, 0, 1, 1)

        self.rules_close = QPushButton(self.rules_page)
        self.rules_close.setObjectName(u"rules_close")
        sizePolicy4.setHeightForWidth(
            self.rules_close.sizePolicy().hasHeightForWidth())
        self.rules_close.setSizePolicy(sizePolicy4)

        self.gridLayout_4.addWidget(self.rules_close, 1, 0, 1, 1)

        self.stacked_widget.addWidget(self.rules_page)
        self.display_page = QWidget()
        self.display_page.setObjectName(u"display_page")
        self.gridLayout_2 = QGridLayout(self.display_page)
        self.gridLayout_2.setObjectName(u"gridLayout_2")
        self.toggle_review = QPushButton(self.display_page)
        self.toggle_review.setObjectName(u"toggle_review")
        sizePolicy4.setHeightForWidth(
            self.toggle_review.sizePolicy().hasHeightForWidth())
        self.toggle_review.setSizePolicy(sizePolicy4)

        self.gridLayout_2.addWidget(self.toggle_review, 3, 2, 1, 1)

        self.move_history = QComboBox(self.display_page)
        self.move_history.setObjectName(u"move_history")
        sizePolicy6 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy6.setHorizontalStretch(1)
        sizePolicy6.setVerticalStretch(0)
        sizePolicy6.setHeightForWidth(
            self.move_history.sizePolicy().hasHeightForWidth())
        self.move_history.setSizePolicy(sizePolicy6)

        self.gridLayout_2.addWidget(self.move_history, 3, 1, 1, 1)

        self.choices = QTableWidget(self.display_page)
        self.choices.setObjectName(u"choices")
        sizePolicy7 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        sizePolicy7.setHorizontalStretch(0)
        sizePolicy7.setVerticalStretch(0)
        sizePolicy7.setHeightForWidth(
            self.choices.sizePolicy().hasHeightForWidth())
        self.choices.setSizePolicy(sizePolicy7)

        self.gridLayout_2.addWidget(self.choices, 1, 0, 1, 3)

        self.resume_here = QPushButton(self.display_page)
        self.resume_here.setObjectName(u"resume_here")
        sizePolicy5.setHeightForWidth(
            self.resume_here.sizePolicy().hasHeightForWidth())
        self.resume_here.setSizePolicy(sizePolicy5)

        self.gridLayout_2.addWidget(self.resume_here, 3, 0, 1, 1)

        self.game_display = QLabel(self.display_page)
        self.game_display.setObjectName(u"game_display")

        self.gridLayout_2.addWidget(self.game_display, 0, 0, 1, 3)

        self.stacked_widget.addWidget(self.display_page)
        self.plot_strength_page = QWidget()
        self.plot_strength_page.setObjectName(u"plot_strength_page")
        self.gridLayout_5 = QGridLayout(self.plot_strength_page)
        self.gridLayout_5.setObjectName(u"gridLayout_5")
        self.label = QLabel(self.plot_strength_page)
        self.label.setObjectName(u"label")

        self.gridLayout_5.addWidget(self.label, 0, 0, 1, 1)

        self.plot_game = QComboBox(self.plot_strength_page)
        self.plot_game.setObjectName(u"plot_game")

        self.gridLayout_5.addWidget(self.plot_game, 0, 1, 1, 2)

        self.lineEdit = QLineEdit(self.plot_strength_page)
        self.lineEdit.setObjectName(u"lineEdit")

        self.gridLayout_5.addWidget(self.lineEdit, 2, 1, 1, 2)

        self.label_2 = QLabel(self.plot_strength_page)
        self.label_2.setObjectName(u"label_2")

        self.gridLayout_5.addWidget(self.label_2, 3, 0, 1, 1)

        self.lineEdit_2 = QLineEdit(self.plot_strength_page)
        self.lineEdit_2.setObjectName(u"lineEdit_2")

        self.gridLayout_5.addWidget(self.lineEdit_2, 3, 1, 1, 2)

        self.reset_plot = QPushButton(self.plot_strength_page)
        self.reset_plot.setObjectName(u"reset_plot")

        self.gridLayout_5.addWidget(self.reset_plot, 6, 2, 1, 1)

        self.start_stop_plot = QPushButton(self.plot_strength_page)
        self.start_stop_plot.setObjectName(u"start_stop_plot")

        self.gridLayout_5.addWidget(self.start_stop_plot, 6, 1, 1, 1)

        self.strengths_label = QLabel(self.plot_strength_page)
        self.strengths_label.setObjectName(u"strengths_label")

        self.gridLayout_5.addWidget(self.strengths_label, 2, 0, 1, 1)

        self.label_3 = QLabel(self.plot_strength_page)
        self.label_3.setObjectName(u"label_3")

        self.gridLayout_5.addWidget(self.label_3, 4, 0, 1, 1)

        self.lineEdit_3 = QLineEdit(self.plot_strength_page)
        self.lineEdit_3.setObjectName(u"lineEdit_3")

        self.gridLayout_5.addWidget(self.lineEdit_3, 4, 1, 1, 2)

        self.stacked_widget.addWidget(self.plot_strength_page)
        self.plot_history_page = QWidget()
        self.plot_history_page.setObjectName(u"plot_history_page")
        self.gridLayout_6 = QGridLayout(self.plot_history_page)
        self.gridLayout_6.setObjectName(u"gridLayout_6")
        self.label_4 = QLabel(self.plot_history_page)
        self.label_4.setObjectName(u"label_4")

        self.gridLayout_6.addWidget(self.label_4, 0, 0, 1, 1)

        self.history_game = QComboBox(self.plot_history_page)
        self.history_game.setObjectName(u"history_game")

        self.gridLayout_6.addWidget(self.history_game, 0, 1, 1, 1)

        self.gridLayout_6.setColumnStretch(0, 1)
        self.gridLayout_6.setColumnStretch(1, 8)
        self.stacked_widget.addWidget(self.plot_history_page)

        self.verticalLayout_2.addWidget(self.stacked_widget)

        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setObjectName(u"menubar")
        self.menubar.setGeometry(QRect(0, 0, 911, 22))
        self.menu_file = QMenu(self.menubar)
        self.menu_file.setObjectName(u"menu_file")
        self.menu_new = QMenu(self.menu_file)
        self.menu_new.setObjectName(u"menu_new")
        self.menu_view = QMenu(self.menubar)
        self.menu_view.setObjectName(u"menu_view")
        self.menu_help = QMenu(self.menubar)
        self.menu_help.setObjectName(u"menu_help")
        self.menu_rules = QMenu(self.menu_help)
        self.menu_rules.setObjectName(u"menu_rules")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName(u"statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.menubar.addAction(self.menu_file.menuAction())
        self.menubar.addAction(self.menu_view.menuAction())
        self.menubar.addAction(self.menu_help.menuAction())
        self.menu_file.addAction(self.menu_new.menuAction())
        self.menu_file.addAction(self.action_open)
        self.menu_file.addAction(self.action_save)
        self.menu_file.addAction(self.action_save_log)
        self.menu_file.addAction(self.action_new_db)
        self.menu_file.addAction(self.action_open_db)
        self.menu_new.addAction(self.action_game)
        self.menu_new.addAction(self.action_comparison)
        self.menu_new.addAction(self.action_plot)
        self.menu_new.addAction(self.action_training_session)
        self.menu_view.addAction(self.action_coordinates)
        self.menu_help.addAction(self.action_about)
        self.menu_help.addAction(self.menu_rules.menuAction())

        self.retranslateUi(MainWindow)

        self.stacked_widget.setCurrentIndex(2)

        QMetaObject.connectSlotsByName(MainWindow)
Exemplo n.º 25
0
    def setupUi(self, MainWindow):
        if not MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.resize(1020, 588)
        self.actionSave = QAction(MainWindow)
        self.actionSave.setObjectName(u"actionSave")
        self.actionExit = QAction(MainWindow)
        self.actionExit.setObjectName(u"actionExit")
        self.actionExit_2 = QAction(MainWindow)
        self.actionExit_2.setObjectName(u"actionExit_2")
        self.openini = QAction(MainWindow)
        self.openini.setObjectName(u"openini")
        self.openjson = QAction(MainWindow)
        self.openjson.setObjectName(u"openjson")
        self.main_widget = QWidget(MainWindow)
        self.main_widget.setObjectName(u"main_widget")
        self.ini_widget = QWidget(self.main_widget)
        self.ini_widget.setObjectName(u"ini_widget")
        self.ini_widget.setGeometry(QRect(670, 10, 341, 551))
        self.initable = QTableWidget(self.ini_widget)
        if (self.initable.columnCount() < 2):
            self.initable.setColumnCount(2)
        self.initable.setObjectName(u"initable")
        self.initable.setEnabled(True)
        self.initable.setGeometry(QRect(10, 60, 321, 451))
        font = QFont()
        self.initable.setFont(font)
        self.initable.setEditTriggers(QAbstractItemView.DoubleClicked)
        self.initable.setDragEnabled(False)
        self.initable.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.initable.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.initable.setWordWrap(False)
        self.initable.setRowCount(0)
        self.initable.setColumnCount(2)
        self.initable.horizontalHeader().setDefaultSectionSize(110)
        self.initable.horizontalHeader().setProperty("showSortIndicator",
                                                     False)
        self.initable.horizontalHeader().setStretchLastSection(True)
        self.initable.verticalHeader().setDefaultSectionSize(21)
        self.inilabel = QLabel(self.ini_widget)
        self.inilabel.setObjectName(u"inilabel")
        self.inilabel.setGeometry(QRect(10, 10, 181, 16))
        self.inipath = QTextBrowser(self.ini_widget)
        self.inipath.setObjectName(u"inipath")
        self.inipath.setEnabled(True)
        self.inipath.setGeometry(QRect(10, 30, 321, 22))
        self.inipath.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.iniapply = QPushButton(self.ini_widget)
        self.iniapply.setObjectName(u"iniapply")
        self.iniapply.setEnabled(True)
        self.iniapply.setGeometry(QRect(250, 520, 80, 21))
        self.inidel = QPushButton(self.ini_widget)
        self.inidel.setObjectName(u"inidel")
        self.inidel.setEnabled(False)
        self.inidel.setGeometry(QRect(10, 520, 80, 21))
        self.iniadd = QPushButton(self.ini_widget)
        self.iniadd.setObjectName(u"iniadd")
        self.iniadd.setEnabled(False)
        self.iniadd.setGeometry(QRect(100, 520, 80, 21))
        self.json_widget = QWidget(self.main_widget)
        self.json_widget.setObjectName(u"json_widget")
        self.json_widget.setGeometry(QRect(0, 10, 661, 551))
        self.checkBox = QCheckBox(self.json_widget)
        self.checkBox.setObjectName(u"checkBox")
        self.checkBox.setEnabled(True)
        self.checkBox.setGeometry(QRect(20, 100, 131, 20))
        self.checkBox.setChecked(True)
        self.delentry = QPushButton(self.json_widget)
        self.delentry.setObjectName(u"delentry")
        self.delentry.setEnabled(False)
        self.delentry.setGeometry(QRect(10, 520, 80, 21))
        self.remote = QLineEdit(self.json_widget)
        self.remote.setObjectName(u"remote")
        self.remote.setEnabled(True)
        self.remote.setGeometry(QRect(20, 130, 601, 22))
        self.textBrowser = QTextBrowser(self.json_widget)
        self.textBrowser.setObjectName(u"textBrowser")
        self.textBrowser.setEnabled(True)
        self.textBrowser.setGeometry(QRect(20, 30, 601, 22))
        self.textBrowser.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.addButton = QPushButton(self.json_widget)
        self.addButton.setObjectName(u"addButton")
        self.addButton.setEnabled(True)
        self.addButton.setGeometry(QRect(280, 160, 61, 22))
        self.table = QTableWidget(self.json_widget)
        if (self.table.columnCount() < 2):
            self.table.setColumnCount(2)
        self.table.setObjectName(u"table")
        self.table.setEnabled(True)
        self.table.setGeometry(QRect(10, 200, 641, 311))
        self.table.setFont(font)
        self.table.setEditTriggers(QAbstractItemView.DoubleClicked)
        self.table.setDragEnabled(False)
        self.table.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.table.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.table.setWordWrap(False)
        self.table.setRowCount(0)
        self.table.setColumnCount(2)
        self.table.horizontalHeader().setDefaultSectionSize(80)
        self.table.horizontalHeader().setProperty("showSortIndicator", False)
        self.table.horizontalHeader().setStretchLastSection(True)
        self.table.verticalHeader().setDefaultSectionSize(21)
        self.path = QLineEdit(self.json_widget)
        self.path.setObjectName(u"path")
        self.path.setEnabled(True)
        self.path.setGeometry(QRect(20, 70, 531, 22))
        self.apply = QPushButton(self.json_widget)
        self.apply.setObjectName(u"apply")
        self.apply.setEnabled(True)
        self.apply.setGeometry(QRect(570, 520, 80, 21))
        self.label = QLabel(self.json_widget)
        self.label.setObjectName(u"label")
        self.label.setGeometry(QRect(20, 10, 181, 16))
        self.browse = QPushButton(self.json_widget)
        self.browse.setObjectName(u"browse")
        self.browse.setGeometry(QRect(560, 70, 61, 22))
        MainWindow.setCentralWidget(self.main_widget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setObjectName(u"menubar")
        self.menubar.setGeometry(QRect(0, 0, 1020, 19))
        self.File = QMenu(self.menubar)
        self.File.setObjectName(u"File")
        self.menuOpen = QMenu(self.File)
        self.menuOpen.setObjectName(u"menuOpen")
        MainWindow.setMenuBar(self.menubar)

        self.menubar.addAction(self.File.menuAction())
        self.File.addAction(self.menuOpen.menuAction())
        self.File.addAction(self.actionSave)
        self.File.addSeparator()
        self.File.addAction(self.actionExit_2)
        self.menuOpen.addAction(self.openini)
        self.menuOpen.addAction(self.openjson)

        self.retranslateUi(MainWindow)

        QMetaObject.connectSlotsByName(MainWindow)
Exemplo n.º 26
0
        # The commitData signal must be emitted when we've finished editing
        # and need to write our changed back to the model.
        self.commitData.emit(editor)
        self.closeEditor.emit(editor, QStyledItemDelegate.NoHint)


if __name__ == "__main__":
    """ Run the application. """
    from PySide6.QtWidgets import (QApplication, QTableWidget,
                                   QTableWidgetItem, QAbstractItemView)
    import sys

    app = QApplication(sys.argv)

    # Create and populate the tableWidget
    tableWidget = QTableWidget(4, 4)
    tableWidget.setItemDelegate(StarDelegate())
    tableWidget.setEditTriggers(QAbstractItemView.DoubleClicked
                                | QAbstractItemView.SelectedClicked)
    tableWidget.setSelectionBehavior(QAbstractItemView.SelectRows)
    tableWidget.setHorizontalHeaderLabels(
        ["Title", "Genre", "Artist", "Rating"])

    data = [["Mass in B-Minor", "Baroque", "J.S. Bach", 5],
            ["Three More Foxes", "Jazz", "Maynard Ferguson", 4],
            ["Sex Bomb", "Pop", "Tom Jones", 3],
            ["Barbie Girl", "Pop", "Aqua", 5]]

    for r in range(len(data)):
        tableWidget.setItem(r, 0, QTableWidgetItem(data[r][0]))
        tableWidget.setItem(r, 1, QTableWidgetItem(data[r][1]))
Exemplo n.º 27
0
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)

        self.column_names = ["Column A", "Column B", "Column C"]

        # Central widget
        self._main = QWidget()
        self.setCentralWidget(self._main)

        # Main menu bar
        self.menu = self.menuBar()
        self.menu_file = self.menu.addMenu("File")
        exit = QAction("Exit", self, triggered=qApp.quit)
        self.menu_file.addAction(exit)

        self.menu_about = self.menu.addMenu("&About")
        about = QAction("About Qt",
                        self,
                        shortcut=QKeySequence(QKeySequence.HelpContents),
                        triggered=qApp.aboutQt)
        self.menu_about.addAction(about)

        # Figure (Left)
        self.fig = Figure(figsize=(5, 3))
        self.canvas = FigureCanvas(self.fig)

        # Sliders (Left)
        self.slider_azim = QSlider(minimum=0,
                                   maximum=360,
                                   orientation=Qt.Horizontal)
        self.slider_elev = QSlider(minimum=0,
                                   maximum=360,
                                   orientation=Qt.Horizontal)

        self.slider_azim_layout = QHBoxLayout()
        self.slider_azim_layout.addWidget(
            QLabel("{}".format(self.slider_azim.minimum())))
        self.slider_azim_layout.addWidget(self.slider_azim)
        self.slider_azim_layout.addWidget(
            QLabel("{}".format(self.slider_azim.maximum())))

        self.slider_elev_layout = QHBoxLayout()
        self.slider_elev_layout.addWidget(
            QLabel("{}".format(self.slider_elev.minimum())))
        self.slider_elev_layout.addWidget(self.slider_elev)
        self.slider_elev_layout.addWidget(
            QLabel("{}".format(self.slider_elev.maximum())))

        # Table (Right)
        self.table = QTableWidget()
        header = self.table.horizontalHeader()
        header.setSectionResizeMode(QHeaderView.Stretch)

        # ComboBox (Right)
        self.combo = QComboBox()
        self.combo.addItems(
            ["Wired", "Surface", "Triangular Surface", "Sphere"])

        # Right layout
        rlayout = QVBoxLayout()
        rlayout.setContentsMargins(1, 1, 1, 1)
        rlayout.addWidget(QLabel("Plot type:"))
        rlayout.addWidget(self.combo)
        rlayout.addWidget(self.table)

        # Left layout
        llayout = QVBoxLayout()
        rlayout.setContentsMargins(1, 1, 1, 1)
        llayout.addWidget(self.canvas, 88)
        llayout.addWidget(QLabel("Azimuth:"), 1)
        llayout.addLayout(self.slider_azim_layout, 5)
        llayout.addWidget(QLabel("Elevation:"), 1)
        llayout.addLayout(self.slider_elev_layout, 5)

        # Main layout
        layout = QHBoxLayout(self._main)
        layout.addLayout(llayout, 70)
        layout.addLayout(rlayout, 30)

        # Signal and Slots connections
        self.combo.currentTextChanged.connect(self.combo_option)
        self.slider_azim.valueChanged.connect(self.rotate_azim)
        self.slider_elev.valueChanged.connect(self.rotate_elev)

        # Initial setup
        self.plot_wire()
        self._ax.view_init(30, 30)
        self.slider_azim.setValue(30)
        self.slider_elev.setValue(30)
        self.fig.canvas.mpl_connect("button_release_event", self.on_click)
Exemplo n.º 28
0
    def __init__(self):
        QWidget.__init__(self)
        self.items = 0

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

        # Chart
        self.chart_view = QChartView()
        self.chart_view.setRenderHint(QPainter.Antialiasing)

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

        # Disabling 'Add' button
        self.add.setEnabled(False)

        self.right = QVBoxLayout()
        self.right.setContentsMargins(10, 10, 10, 10)

        self.right_top = QGridLayout()

        self.right_top.addWidget(QLabel("Description"), 0, 0, 1, 1)
        self.right_top.addWidget(self.description, 0, 1, 1, 3)
        self.right_top.addWidget(QLabel("Quantity"), 1, 0, 1, 1)
        self.right_top.addWidget(self.quantity, 1, 1, 1, 1)
        self.right_top.addWidget(self.add, 1, 2, 1, 2)

        self.right.addLayout(self.right_top)
        self.right.addWidget(self.chart_view)

        self.right_bottom = QGridLayout()
        self.right_bottom.addWidget(self.plot, 0, 0, 1, 2)
        self.right_bottom.addWidget(self.clear, 1, 0)
        self.right_bottom.addWidget(self.quit, 1, 1)

        self.right.addLayout(self.right_bottom)

        # 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.plot.clicked.connect(self.plot_data)
        self.clear.clicked.connect(self.clear_table)
        self.description.textChanged[str].connect(self.check_disable)
        self.quantity.textChanged[str].connect(self.check_disable)
Exemplo n.º 29
0
    :param str code:
    :return:
    """
    code_hex = code.replace('#', '')
    rgb = tuple(int(code_hex[i:i + 2], 16) for i in (0, 2, 3))
    return QColor.fromRgb(rgb[0], rgb[1], rgb[2])


if __name__ == '__main__':
    colors = [("Red", "#FF0000"), ("Green", "#00FF00"), ("Blue", "#0000FF"),
              ("Black", "#000000"), ("White", "#FFFFFF"),
              ("Electric Green", "#41CD52"), ("Dark Blue", "#222840"),
              ("Yellow", "#F9E56d")]
    app = QApplication()
    table = QTableWidget()
    table.setRowCount(len(colors))
    table.setColumnCount(len(colors[0]) + 1)
    table.setHorizontalHeaderLabels(['Name', 'Hex Code', 'Color'])

    for i, (name, code) in enumerate(colors):
        item_name = QTableWidgetItem(name)
        item_code = QTableWidgetItem(code)
        item_color = QTableWidgetItem()
        item_color.setBackground(get_rgb_from_hex(code))
        table.setItem(i, 0, item_name)
        table.setItem(i, 1, item_code)
        table.setItem(i, 2, item_color)
    table.show()
    sys.exit(app.exec_())
Exemplo n.º 30
0
    def __init__(self, parent=None):
        super(LocationDialog, self).__init__(parent)

        self.format_combo = QComboBox()
        self.format_combo.addItem("Native")
        self.format_combo.addItem("INI")

        self.scope_cCombo = QComboBox()
        self.scope_cCombo.addItem("User")
        self.scope_cCombo.addItem("System")

        self.organization_combo = QComboBox()
        self.organization_combo.addItem("Trolltech")
        self.organization_combo.setEditable(True)

        self.application_combo = QComboBox()
        self.application_combo.addItem("Any")
        self.application_combo.addItem("Application Example")
        self.application_combo.addItem("Assistant")
        self.application_combo.addItem("Designer")
        self.application_combo.addItem("Linguist")
        self.application_combo.setEditable(True)
        self.application_combo.setCurrentIndex(3)

        format_label = QLabel("&Format:")
        format_label.setBuddy(self.format_combo)

        scope_label = QLabel("&Scope:")
        scope_label.setBuddy(self.scope_cCombo)

        organization_label = QLabel("&Organization:")
        organization_label.setBuddy(self.organization_combo)

        application_label = QLabel("&Application:")
        application_label.setBuddy(self.application_combo)

        self.locations_groupbox = QGroupBox("Setting Locations")

        self.locations_table = QTableWidget()
        self.locations_table.setSelectionMode(QAbstractItemView.SingleSelection)
        self.locations_table.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.locations_table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.locations_table.setColumnCount(2)
        self.locations_table.setHorizontalHeaderLabels(("Location", "Access"))
        self.locations_table.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
        self.locations_table.horizontalHeader().resizeSection(1, 180)

        self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)

        self.format_combo.activated.connect(self.update_locations)
        self.scope_cCombo.activated.connect(self.update_locations)
        self.organization_combo.lineEdit().editingFinished.connect(self.update_locations)
        self.application_combo.lineEdit().editingFinished.connect(self.update_locations)
        self.button_box.accepted.connect(self.accept)
        self.button_box.rejected.connect(self.reject)

        locations_layout = QVBoxLayout(self.locations_groupbox)
        locations_layout.addWidget(self.locations_table)

        mainLayout = QGridLayout(self)
        mainLayout.addWidget(format_label, 0, 0)
        mainLayout.addWidget(self.format_combo, 0, 1)
        mainLayout.addWidget(scope_label, 1, 0)
        mainLayout.addWidget(self.scope_cCombo, 1, 1)
        mainLayout.addWidget(organization_label, 2, 0)
        mainLayout.addWidget(self.organization_combo, 2, 1)
        mainLayout.addWidget(application_label, 3, 0)
        mainLayout.addWidget(self.application_combo, 3, 1)
        mainLayout.addWidget(self.locations_groupbox, 4, 0, 1, 2)
        mainLayout.addWidget(self.button_box, 5, 0, 1, 2)

        self.update_locations()

        self.setWindowTitle("Open Application Settings")
        self.resize(650, 400)