Пример #1
0
    def setupUi(self, frame):
        super().setupUi(frame)
        self.frame = frame

        # Configure table
        self.tableView.horizontalHeader().setSectionsClickable(False)
        self.tableView.setSelectionMode(QAbstractItemView.SingleSelection)
        self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.tableView.horizontalHeader().setDefaultAlignment(Qt.AlignLeft)
        if QSysInfo.productType() == 'windows' and QSysInfo.productVersion() == '10':
            self.tableView.horizontalHeader().setStyleSheet(
                'border-top: 0px; '
                'border-left: 0px; '
                'border-right: 0px; '
                'border-bottom: 1px solid gray;')

        # Define models
        self.data_file_container = table_model.DataFileContainer()
        self.dec_model = declination_model.Declination()
        self.tilt_model = TiltCurveModel(
            application_directory() / 'Calibration Tables')

        # Connect models
        self.tableView.setModel(self.data_file_container)
        self.tableView.resizeColumnsToContents()
        self.comboBox_tilt_tables.setModel(self.tilt_model)

        self.file_loader = file_loader.FileLoader(self.file_queue)
        self._connect_signals_to_slots()
        restore_last_session(self)
Пример #2
0
    def __init__(self, content: str, title='测试项信息'):
        super().__init__(parent=None)
        self.setWindowFlags(Qt.Window)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWindowTitle(title)
        __class__.prev_actived = True
        __class__.prev_window = self

        self.table = QTableView()
        self.table.horizontalHeader().setHighlightSections(True)
        self.table.horizontalHeader().setSectionResizeMode(
            QHeaderView.Interactive)
        self.table.horizontalHeader().setStretchLastSection(True)
        self.table.verticalHeader().setVisible(True)
        self.restoreQsetting()

        self.table.setModel(PandasModel(content))

        if QSysInfo.productType() == 'windows' and QSysInfo.productVersion(
        ) == '10':
            self.table.horizontalHeader().setStyleSheet(
                "QHeaderView::section { border: 1px solid #D8D8D8; }")

        layout = QVBoxLayout()
        layout.addWidget(self.table)
        self.setLayout(layout)
Пример #3
0
    def __init_components(self):
        """Inicializa los atributos de la clase y otros componentes del objeto.

        Note:
            Esta función no debe ser llamada desde el exterior, puesto que su uso es interno en la
            clase.
        """
        self.setFixedWidth(440)
        self.setFixedHeight(330)
        self.layout = QVBoxLayout(self)

        self.socios_check_box = QCheckBox()
        self.prestamos_check_box = QCheckBox()
        self.socios_path = QLineEdit()
        self.prestamos_path = QLineEdit()
        self.start_with_so_check_box = QCheckBox("Iniciar con el sistema operativo")
        socios_button = QPushButton()
        prestamos_button = QPushButton()
        socios_button.setIcon(QIcon(":res/search_icon.png"))
        socios_button.setStyleSheet("height: 18px; background-color: #232629;")
        prestamos_button.setIcon(QIcon(":res/search_icon.png"))
        prestamos_button.setStyleSheet("height: 18px; background-color: #232629;")
        cancel_button = QPushButton("Cancelar")
        cancel_button.setObjectName("normal_button")
        accept_button = QPushButton("Aceptar")
        accept_button.setObjectName("accept_button")

        self.__load_options()
        self.layout.addLayout(HLayout(
            self.socios_check_box,
            QLabel("Archivo de Socios y Ahorros"),
            True))
        self.layout.addLayout(HLayout(self.socios_path, socios_button))
        self.layout.addSpacing(2)
        self.layout.addLayout(HLayout(
            self.prestamos_check_box,
            QLabel("Archivo de Préstamos"),
            True))
        self.layout.addLayout(HLayout(self.prestamos_path, prestamos_button))
        if QSysInfo.productType() == "windows":
            self.layout.addSpacing(10)
            self.layout.addWidget(self.start_with_so_check_box)
        self.layout.addStretch()
        self.layout.addLayout(HLayout(cancel_button, accept_button))
        self.setModal(True)

        socios_button.clicked.connect(self.__select_socios_path)
        prestamos_button.clicked.connect(self.__select_prestamos_path)
        cancel_button.clicked.connect(self.reject)
        accept_button.clicked.connect(self.__save_state)
Пример #4
0
 def set_start_on_system(cls):
     """Habilita la opción de iniciar la aplicación con el sistema.
     Esta funcionalidad solo se habilita si el sistema es Windows y si se está ejecutando desde
     un .exe
     """
     app_path = QCoreApplication.applicationFilePath()
     if QSysInfo.productType() == "windows" \
     and os.path.basename(app_path) == "capounet_sync.exe":
         settings = QSettings(
             "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
             QSettings.NativeFormat)
         if cls.start_on_system:
             settings.setValue("CAPOUNET SYNC",
                               QDir.toNativeSeparators(app_path))
             settings.sync()
         else:
             settings.remove("CAPOUNET SYNC")
Пример #5
0
 def setupUi(self, frame):
     self.frame = frame
     super().setupUi(frame)
     self.tableWidget.horizontalHeader().setSectionsClickable(False)
     self.tableWidget.horizontalHeader().setFixedHeight(30)
     self.tableWidget.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.tableWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     table_width = self.tableWidget.horizontalHeader().length()
     self.tableWidget.setFixedSize(
         table_width,
         self.tableWidget.verticalHeader().length() +
         self.tableWidget.horizontalHeader().height())
     self.tableWidget.horizontalHeaderItem(0).setTextAlignment(Qt.AlignLeft)
     self.tableWidget.setColumnWidth(0, table_width / 2)
     self.tableWidget.setColumnWidth(1, table_width / 4)
     self.tableWidget.setColumnWidth(2, table_width / 4)
     if QSysInfo.productType() == 'windows' and QSysInfo.productVersion(
     ) == '10':
         self.tableWidget.horizontalHeader().setStyleSheet(
             'border-top: 0px; '
             'border-left: 0px; '
             'border-right: 0px; '
             'border-bottom: 1px solid gray;')
     self.commands = Commands(self)
     self.logger = LoggerQueryThread(self.commands, self.queue)
     self.logger.query_update.connect(self.query_slot)
     self.logger.connected.connect(self.connected_slot)
     self.logger.error_code.connect(self.show_run_error)
     self.logger.error_message.connect(self.show_warning)
     self.logger.start()
     self.time_updater = TimeUpdater()
     self.time_updater.time_signal.connect(self.update_time_slot)
     self.time_updater.start()
     self.pushButton_sync_clock.clicked.connect(
         lambda: self.queue.put('sync_time'))
     self.pushButton_start.clicked.connect(self.run)
     self.pushButton_stop.clicked.connect(self.stop)
     self.pushButton_connected.clicked.connect(self.reset)
     self.status_bar = self.get_status_bar()
     self.status_bar.addPermanentWidget(self.statusbar_connect_status)
     self.statusbar_connect_status.setText('  Auto Connect  ')
     self.status_bar.addPermanentWidget(self.statusbar_serial_number)
     self.status_bar.addPermanentWidget(self.statusbar_logging_status)
Пример #6
0
    def __init__(self, parent=None, title='记录查询'):
        super().__init__(parent=parent)
        __class__.prev_actived = True
        __class__.prev_window = self

        self.setWindowTitle(title)
        self.setWindowFlags(Qt.Window)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.search_button = QPushButton('查询')
        self.search_button.clicked.connect(self.onSearch)

        header_lables = [
            'PK', 'ID', '产品', '版本', '芯片ID', '开始时间', '结束时间', '总时间', '结果', '信息'
        ]
        self.table = QTableWidget(1, len(header_lables))
        self.table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.table.setHorizontalHeaderLabels(header_lables)
        self.table.horizontalHeader().setHighlightSections(True)
        self.table.horizontalHeader().setSectionResizeMode(
            QHeaderView.Interactive)
        self.table.horizontalHeader().setStretchLastSection(True)
        self.table.verticalHeader().setVisible(False)
        self.table.cellDoubleClicked.connect(self.onCellClicked)
        self.table.hideColumn(0)
        self.idx = 0

        if QSysInfo.productType() == 'windows' and QSysInfo.productVersion(
        ) == '10':
            self.table.horizontalHeader().setStyleSheet(
                "QHeaderView::section { border: 1px solid #D8D8D8; }")

        layout = QVBoxLayout()
        layout.addWidget(self.search_button)
        layout.addWidget(self.table)

        self.setLayout(layout)
        self.restoreQsetting()
Пример #7
0
def get_default_device():
    device = QSysInfo.machineHostName()
    if device.lower() == "localhost":
        device = QSysInfo.productType()
    return "".join([c for c in device if DeviceName.regex.match(c)])
Пример #8
0
def get_default_device():
    device = QSysInfo.machineHostName()
    if device.lower() == "localhost":
        device = QSysInfo.productType()
    return "".join([c for c in device if re.match(r"[\w\-]", c)])
Пример #9
0
def get_default_device():
    return "".join([c for c in QSysInfo.productType() if DeviceName.regex.match(c)])