示例#1
0
    def init_ui(self) -> None:
        self.setStyleSheet(get_color_scheme())
        self.merge_cells()
        self.init_header_ui()
        self.highlight_data([3, 4, 5, 6], highlight_color=None, bold=True)
        self.highlight_data([7, 8, 9, 10],
                            highlight_color=QColor(128, 159, 255),
                            bold=True)
        self.highlight_data([11, 12, 13, 14],
                            highlight_color=QColor(0, 153, 51),
                            bold=True)

        self.table_view.setShowGrid(False)
        self.table_view.horizontalHeader().setSectionResizeMode(
            QHeaderView.ResizeToContents)
        self.table_view.horizontalHeader().hide()
        self.table_view.verticalHeader().hide()
        self.table_view.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.table_view.setSelectionBehavior(QTableView.SelectRows)
        self.table_view.setEditTriggers(QTableView.NoEditTriggers)
        user_w, user_h = get_user_resolution()
        for i in range(self.get_row_count()):
            self.table_view.setRowHeight(i, int(0.019 * user_h))
        _w = int(user_w * 0.443)
        _h = int(user_h * 0.713)
        self.resize(_w, _h)
示例#2
0
    def __init__(self, parent, realrun: bool):
        super(SideDock, self).__init__(parent)
        self.is_realrun = realrun

        _, self.user_screen_h = wgv_utils.get_user_resolution()
        self.qsettings = QSettings(wgv_data.get_qsettings_file(), QSettings.IniFormat)
        if self.qsettings.contains(QKEYS.EXP_AUTO) and self.qsettings.value(QKEYS.EXP_AUTO, type=bool):
            logger.debug("Auto expedition is on")
            self.is_exp_auto = True
        else:
            logger.debug("Auto expedition is off")
            self.is_exp_auto = False

        self.equipment_names = wgv_data.get_shipEquipmnt()
        self.ship_names = wgv_data.get_processed_userShipVo()

        # index 0 for daily, 1 for weekly, 2+ for tasks/events
        self.task_counter_desc_labels = []
        self.task_counter_labels = []
        self.task_counter_timers = []
        self.task_counters = []

        self.name_layout_widget = QWidget(self)
        self.name_layout = QHBoxLayout(self.name_layout_widget)
        self.name_label = QLabel(self.name_layout_widget)
        self.lvl_label = QLabel(self.name_layout_widget)
        self.ship_count_label = QLabel(self.name_layout_widget)
        self.equip_count_label = QLabel(self.name_layout_widget)
        self.collect_count_label = QLabel(self.name_layout_widget)

        self.sign_widget = QLineEdit(self)
        self.table_model = ResourceTableModel()
        self.table_view = QTableView(self)
        self.bath_list_view = BathListView()
        self.bath_list_view_widget = QWidget(self)
        self.bath_list_view_layout = QVBoxLayout(self.bath_list_view_widget)
        self.triple_list_view_widget = QWidget(self)
        self.triple_list_view = QHBoxLayout(self.triple_list_view_widget)
        self.build_list_view = BuildListView()
        self.dev_list_view = DevListView()
        self.exp_list_view = ExpListView(parent.main_tabs)
        self.task_list_view = TaskListView()
        self.task_panel_widget = QWidget(self)
        self.task_panel_view = QHBoxLayout(self.task_panel_widget)
        self.countdowns_layout_widget = QWidget(self)
        self.countdowns_layout = QVBoxLayout(self.countdowns_layout_widget)

        self.sig_resized.connect(self.update_geometry)
        self.sig_closed.connect(parent.on_dock_closed)

        self._init_ui()
        self.set_data()
示例#3
0
 def __init__(self, parent, title: str):
     super().__init__(parent)
     self.setWindowTitle(title)
     self.setStyleSheet(get_color_scheme())
     self.progress_bar = QProgressBar()
     self.progress_bar.setValue(0)
     self.setCentralWidget(self.progress_bar)
     user_w, user_h = get_user_resolution()
     _w = int(user_w * 0.2)
     _h = int(user_h * 0.05)
     self.resize(_w, _h)
     _center_QMainWindow(self)
     self.hide()
示例#4
0
 def __init__(self, parent, title: str, text: str):
     super().__init__()
     self.setWindowTitle(title)
     user_w, user_h = get_user_resolution()
     self.w = int(user_w * 0.3)
     self.h = int(self.w * 0.618)
     label = ScrollLabel(self)
     label.setText(text)
     # TODO? use setContentMargins to fill the window; instead of setGeometry (inelegant)
     label.setGeometry(0, 0, self.w, self.h)
     self.resize(self.w, self.h)
     _center_QMainWindow(self)
     self.sig_close.connect(parent.delete_version_log)
示例#5
0
    def init_ui(self) -> None:
        self.set_color_scheme()
        if self.qsettings.contains(QKEYS.UI_MAIN) and self.qsettings.value(
                QKEYS.UI_MAIN, type=bool) is True:
            new_w = self.qsettings.value(QKEYS.UI_MAIN_W, type=int)
            new_h = self.qsettings.value(QKEYS.UI_MAIN_H, type=int)
            new_pos = self.qsettings.value(QKEYS.UI_MAIN_POS)
            self.resize(new_w, new_h)
            self.move(new_pos)
        else:
            user_w, user_h = wgv_utils.get_user_resolution()
            self.resize(int(0.67 * user_w), int(0.67 * user_h))

        self.setMenuBar(self.menu_bar)
        self.setCentralWidget(self.main_tabs)

        self.setLayout(QHBoxLayout())
        self.setWindowTitle(
            f"Warship Girls Viewer v{wgv_utils.get_app_version()}")
示例#6
0
    def __init__(self):
        super().__init__()
        self._version_check = WGViewerVersionCheck()

        self.sig_login.connect(self.start_login)
        self.sig_close.connect(self.on_main_interface_setup)
        self.qsettings = QSettings(wgv_data.get_qsettings_file(),
                                   QSettings.IniFormat)
        self.encryptor = Encryptor()
        self.channel = ""
        self.server = ""
        self.mi = None
        self.res1: bool = False
        self.res2: bool = False

        self.lineEdit_username = QLineEdit()
        self.lineEdit_password = QLineEdit()
        self.combo_platform = QComboBox()
        self.combo_server = QComboBox()
        # TODO? it's hard to get this checkbox to render the same way across platforms (even with get_user_resolution())
        self.check_disclaimer = QCheckBox('I have read')
        # TODO? trailing space
        # To limit the trailing space of the checkbox text with max width; still, there is ~2 whitespaces width space presents
        # set text all in label would cause user unable to click text to toggle checkbox; differs from other checkbox, (bad design IMO)
        user_w, _ = wgv_utils.get_user_resolution()
        self.check_disclaimer.setMaximumWidth(int(0.08 * user_w))
        self.check_save = QCheckBox("Store login info locally with encryption")
        self.check_auto = QCheckBox("Auto login on the application start")
        self.button_login = QPushButton("Login")
        self.button_bypass = QPushButton("Bypass Login with Existing Cookie")
        self.button_bypass.setToolTip(
            "If you previously logged in with WGViewer AND haven't logged in through other means,\n"
            "you may use this option to bypass login.")

        self.container = QWidget()
        main_layout = QVBoxLayout()
        main_layout.addWidget(self.container)
        self.layout = QGridLayout(self.container)

        self.init_ui()
        self.setLayout(main_layout)

        self.auto_start()
示例#7
0
    def init_ui(self) -> None:
        if self.qsettings.value(QKEYS.LOGIN_SAVE, type=bool) is True:
            name = self.qsettings.value(QKEYS.LOGIN_USER)
            server = self.qsettings.value(QKEYS.LOGIN_SERVER)
            platform = self.qsettings.value(QKEYS.LOGIN_PLATFORM)
            disclaimer = self.qsettings.value(QKEYS.LOGIN_DISCLAIMER,
                                              type=bool)
            auto_login = self.qsettings.value(QKEYS.LOGIN_AUTO, type=bool)

            # Don't change the order
            self.init_name_field(name)
            self.init_password_field(self._get_password())
            self.init_server_field(server)
            self.init_platform_field(platform)
            if disclaimer is True:
                self.init_check_disclaimer(True)
            else:
                self.init_check_disclaimer(False)
            self.init_check_save(True)
            if auto_login is True:
                self.init_check_auto(True)
            else:
                self.init_check_auto(False)
        else:
            self.init_name_field()
            self.init_password_field()
            self.init_platform_field()
            self.init_server_field()
            self.init_check_disclaimer()
            self.init_check_save()
            self.init_check_auto()

        self.init_disclaimer_link()
        self.layout.setColumnStretch(0, 0)
        self.layout.setColumnStretch(1, 1)
        self.layout.setColumnStretch(2, 1)
        user_w, user_h = wgv_utils.get_user_resolution()
        self.init_login_buttons(user_h)
        self.resize(int(0.26 * user_w), int(0.12 * user_h))
        self.setStyleSheet(wgv_utils.get_color_scheme())
        self.setWindowTitle(
            f'Warship Girls Viewer v{wgv_utils.get_app_version()} Login')
示例#8
0
    def __init__(self, parent, row: int, col: int, cid: int,
                 button_enable: bool):
        super().__init__()
        self.parent = parent
        self._row = row
        self._col = col
        self.cid = int(cid)
        self.button_enable = button_enable

        user_w, user_h = get_user_resolution()
        self.width = int(user_w * 0.32)
        self.height = int(user_h * 0.55)
        self.id_list = []
        self.lock_icon = QIcon(get_data_path("assets/icons/lock_64.png"))
        self.trans = SCONST.equip_spec

        self.button = QPushButton('Unequip Current Equipment')
        self.tab = QTableWidget()
        self.init_ui()
        if self.button_enable:
            pass
        else:
            self.button.setEnabled(False)
示例#9
0
    def init_ui(self) -> None:
        self.setStyleSheet(get_color_scheme())
        self.setWindowTitle('Settings')

        user_w, user_h = get_user_resolution()
        w = int(user_w / 3)
        h = int(user_h * 4 / 9)
        self.resize(w, h)
        self.setCentralWidget(self.vertical_tabs)

        self.reset_button.clicked.connect(self.on_reset)
        status_bar_content_widget = QWidget()
        status_bar_content_layout = QGridLayout(status_bar_content_widget)
        status_bar_content_layout.addWidget(
            QLabel(
                "Changes are auto saved; some will only be effective upon next start"
            ), 0, 0, 1, 1, Qt.AlignVCenter | Qt.AlignLeft)
        status_bar_content_layout.addWidget(self.reset_button, 0, 1, 1, 1,
                                            Qt.AlignVCenter | Qt.AlignRight)
        self.status_bar.addWidget(status_bar_content_widget, 1)
        self.status_bar.setSizeGripEnabled(False)
        self.setStatusBar(self.status_bar)
        self.setLayout(QVBoxLayout())
示例#10
0
    def init_ui(self) -> None:
        self.setStyleSheet(get_color_scheme())
        self.setWindowTitle('WGViewer - Thermopylae')

        self.tab.setColumnCount(4)
        for ship_id, ship in self.user_ships.items():
            self.add_table_row(self.tab, ship_id, ship, self.ship_class,
                               self.cost_lim)

        self.tab.resizeColumnsToContents()
        self.tab.horizontalHeader().setSectionResizeMode(
            2, QHeaderView.Stretch)

        self.tab.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.tab.setHorizontalHeaderLabels(['Type', 'ID', 'Name', 'Level'])
        self.tab.setEditTriggers(QTableWidget.NoEditTriggers)
        self.tab.setSelectionBehavior(QTableWidget.SelectRows)
        self.tab.setSelectionMode(QTableWidget.SingleSelection)

        self.tab.doubleClicked.connect(self.set_ship)

        user_w, user_h = get_user_resolution()
        width = int(0.18 * user_w)
        height = int(0.55 * user_h)
        self.resize(width, height)
        # Following attempts to not block the selection panel
        # TODO? PyQt spawn a new window without blocking the old main window
        #   if old window is in full-screen, then spawn in a fixed position
        new_point = get_screen_center() - self.rect().center()
        self.move(new_point.x() + int(0.1 * user_w), new_point.y())

        content_layout = QVBoxLayout()
        content_layout.addWidget(self.tab)
        window = QWidget()
        window.setLayout(content_layout)
        self.setCentralWidget(window)
示例#11
0
 def __init__(self):
     super().__init__()
     user_w, _ = get_user_resolution()
     self.offset = QSize(int(0.01 * user_w), int(0.01 * user_w))