Commit 89e37196 authored by dmMaze's avatar dmMaze
Browse files

improve UI text rendering & reduced leftbar widgets

parent 7800cb90
Loading
Loading
Loading
Loading
+12 −30
Original line number Diff line number Diff line
@@ -373,6 +373,10 @@ QPushButton {
    border-radius: 4px;
}

QPushButton#RunButton {
    font-size: 12px;
}

NoBorderPushBtn {
    background-color: @noboderPushBtnBackgroundColor;
    border: none;
@@ -455,14 +459,6 @@ TextCheckerLabel::hover {
    background-color: rgba(30, 147, 229, 20%);
}

TextCheckerLabel#OCRChecker {
    height: 34px;
    width: 66;
    padding-left: 7px;
    padding-right: 7px;
    font-size: 22px;
}

QCheckBox#TransChecker::indicator {
    padding-left: 8px;
    padding-right: 8px;
@@ -559,8 +555,8 @@ QProgressBar {
}

ShowPageListChecker::indicator{
    height: 37px;
    width: 37px;
    height: 27px;
    width: 27px;
    image: url(icons/showpagelist.svg);
}

@@ -574,8 +570,8 @@ ShowPageListChecker::indicator:checked
}

QCheckBox#GlobalSearchChecker::indicator{
    height: 38px;
    width: 38px;
    height: 28px;
    width: 28px;
    image: url(icons/search.svg);
}

@@ -590,8 +586,8 @@ QCheckBox#GlobalSearchChecker::indicator:checked


StateChecker#ImgTransChecker::indicator{
    height: 37px;
    width: 37px;
    height: 27px;
    width: 27px;
    image: url(icons/leftbar_imgtrans.svg);
}

@@ -606,8 +602,8 @@ StateChecker#ImgTransChecker::indicator:checked
}

StateChecker#ConfigChecker::indicator{
    height: 37px;
    width: 37px;
    height: 27px;
    width: 27px;
    image: url(icons/leftbar_config.svg);
}

@@ -620,20 +616,6 @@ StateChecker#ConfigChecker::indicator:checked
    image: url(icons/leftbar_config_activate.svg);
}

StateChecker#OCRChecker::indicator{
    height: 28px;
    width: 28px;
    image: url(icons/bottombar_ocr.svg);
}

StateChecker#OCRChecker::indicator:checked{
    height: 28px;
    width: 28px;
    background-color: rgba(30, 147, 229);
    image: url(icons/bottombar_ocr_activate.svg);
}


QProgressBar::chunk {
    background-color: #b0cbf8;
}
+12 −14
Original line number Diff line number Diff line
@@ -246,7 +246,7 @@ def main():
        # font database does not initialise on windows with qpa -offscreen:
        # whttps://github.com/dmMaze/BallonsTranslator/issues/519
        from qtpy.QtCore import QStandardPaths
        font_dir_list = QStandardPaths.standardLocations(QStandardPaths.FontsLocation)
        font_dir_list = QStandardPaths.standardLocations(QStandardPaths.StandardLocation.FontsLocation)
        for fd in font_dir_list:
            fp_list = find_all_files_recursive(fd, FONT_EXTS)
            for fp in fp_list:
@@ -258,17 +258,15 @@ def main():
        fdb = QFontDatabase()
        shared.FONT_FAMILIES = set(fdb.families())

    yahei = QFont('Microsoft YaHei UI')
    if yahei.exactMatch() and not sys.platform == 'darwin':
        QGuiApplication.setFont(yahei)
        shared.DEFAULT_FONT_FAMILY = 'Microsoft YaHei UI'
        shared.APP_DEFAULT_FONT = 'Microsoft YaHei UI'
    else:
        app_font = app.font().family()
        shared.DEFAULT_FONT_FAMILY = app_font
        shared.APP_DEFAULT_FONT = app_font
    app_font = QFont('Microsoft YaHei UI')
    if not app_font.exactMatch() or sys.platform == 'darwin':
        app_font = app.font()
    app_font.setHintingPreference(QFont.HintingPreference.PreferNoHinting)
    app_font.setStyleStrategy(QFont.StyleStrategy.PreferAntialias | QFont.StyleStrategy.NoSubpixelAntialias)
    QGuiApplication.setFont(app_font)
    shared.DEFAULT_FONT_FAMILY = app_font.family()
    shared.APP_DEFAULT_FONT = app_font.family()
    
    shared.APP_DEFAULT_FONT = app.font().defaultFamily()
    if args.ldpi:
        shared.LDPI = args.ldpi

@@ -279,11 +277,11 @@ def main():
    BT = ballontrans
    BT.restart_signal.connect(restart)


    if not args.headless:
        if shared.SCREEN_W > 1707 and sys.platform == 'win32':   # higher than 2560 (1440p) / 1.5
            # https://github.com/dmMaze/BallonsTranslator/issues/220
            BT.comicTransSplitter.setHandleWidth(10)
            print(BT.comicTransSplitter.handleWidth())
            BT.comicTransSplitter.setHandleWidth(7)

        ballontrans.setWindowIcon(QIcon(shared.ICON_PATH))
        ballontrans.show()
+7 −3
Original line number Diff line number Diff line
@@ -140,7 +140,11 @@ class LeftBar(Widget):
        openBtnToolBar.addWidget(self.openBtn)
        
        self.runImgtransBtn = QPushButton()
        self.runImgtransBtn.setText(self.tr('RUN'))
        self.runImgtransBtn.setObjectName('RunButton')
        self.runImgtransBtn.setText(self.tr('Run'))
        font = self.runImgtransBtn.font()
        font.setPixelSize(10)
        self.runImgtransBtn.setFont(font)
        self.runImgtransBtn.setFixedSize(LEFTBTN_WIDTH, LEFTBTN_WIDTH)
        self.run_imgtrans_clicked = self.runImgtransBtn.clicked
        self.runImgtransBtn.setFixedSize(LEFTBTN_WIDTH, LEFTBTN_WIDTH)
@@ -153,9 +157,9 @@ class LeftBar(Widget):
        vlayout.addItem(QSpacerItem(0, 0, QSizePolicy.Minimum, QSizePolicy.Expanding))
        vlayout.addWidget(self.configChecker)
        vlayout.addWidget(self.runImgtransBtn)
        vlayout.setContentsMargins(padding, 0, padding, int(LEFTBTN_WIDTH / 2))
        vlayout.setContentsMargins(padding, LEFTBTN_WIDTH // 2, padding, LEFTBTN_WIDTH // 2)
        vlayout.setAlignment(Qt.AlignmentFlag.AlignCenter)
        vlayout.setSpacing(int(LEFTBTN_WIDTH / 2))
        vlayout.setSpacing(LEFTBTN_WIDTH * 3 // 4)
        self.setGeometry(0, 0, 300, 500)
        self.setMouseTracking(True)

+2 −1
Original line number Diff line number Diff line
@@ -80,7 +80,8 @@ class TextShadowGroup(QGroupBox):

class TextGradientGroup(QGroupBox):
    def __init__(self, on_param_changed: Callable = None):
        super().__init__(title=self.tr('Gradient'))
        super().__init__()
        self.setTitle(self.tr('Gradient'))
        self.on_param_changed = on_param_changed

        self.start_picker = SmallColorPickerLabel(self, param_name='gradient_start_color')
+2 −1
Original line number Diff line number Diff line
@@ -625,9 +625,10 @@ class TextBlkItem(QGraphicsTextItem):
        format = cursor.charFormat()
        font = self.document().defaultFont()
        
        font.setHintingPreference(QFont.HintingPreference.PreferNoHinting)
        font.setFamily(ffmat.font_family)
        font.setPointSizeF(ffmat.size_pt)
        font.setHintingPreference(QFont.HintingPreference.PreferNoHinting)
        font.setStyleStrategy(QFont.StyleStrategy.PreferAntialias | QFont.StyleStrategy.NoSubpixelAntialias)

        fweight = ffmat.font_weight
        if fweight is  None:
Loading