Fix high DPI rendering of the welcome wizard

This commit is contained in:
Kovid Goyal 2016-09-01 08:27:53 +05:30
parent 9f388e3564
commit 554886b958
2 changed files with 4 additions and 17 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

View File

@ -10,7 +10,7 @@ import os, traceback, re
from contextlib import closing from contextlib import closing
from PyQt5.Qt import (QWizard, QWizardPage, QPixmap, Qt, QAbstractListModel, from PyQt5.Qt import (QWizard, QWizardPage, QIcon, Qt, QAbstractListModel,
QItemSelectionModel, pyqtSignal, QItemSelection, QDir) QItemSelectionModel, pyqtSignal, QItemSelection, QDir)
from calibre import __appname__ from calibre import __appname__
from calibre.constants import (filesystem_encoding, iswindows, plugins, from calibre.constants import (filesystem_encoding, iswindows, plugins,
@ -21,7 +21,6 @@ from calibre.gui2.wizard.library_ui import Ui_WizardPage as LibraryUI
from calibre.gui2.wizard.finish_ui import Ui_WizardPage as FinishUI from calibre.gui2.wizard.finish_ui import Ui_WizardPage as FinishUI
from calibre.gui2.wizard.kindle_ui import Ui_WizardPage as KindleUI from calibre.gui2.wizard.kindle_ui import Ui_WizardPage as KindleUI
from calibre.gui2.wizard.stanza_ui import Ui_WizardPage as StanzaUI from calibre.gui2.wizard.stanza_ui import Ui_WizardPage as StanzaUI
from calibre.gui2 import min_available_height, available_width
from calibre.utils.localization import localize_user_manual_link from calibre.utils.localization import localize_user_manual_link
from calibre.utils.config import dynamic, prefs from calibre.utils.config import dynamic, prefs
@ -786,13 +785,8 @@ class Wizard(QWizard):
def __init__(self, parent): def __init__(self, parent):
QWizard.__init__(self, parent) QWizard.__init__(self, parent)
self.setWindowTitle(__appname__+' '+_('welcome wizard')) self.setWindowTitle(__appname__+' '+_('welcome wizard'))
p = QPixmap() self.setPixmap(self.LogoPixmap, QIcon(I('library.png')).pixmap(48, 48))
p.loadFromData(open(P('content_server/calibre.png'), 'rb').read()) self.setWizardStyle(self.ModernStyle)
self.setPixmap(self.LogoPixmap, p.scaledToHeight(80,
Qt.SmoothTransformation))
self.setPixmap(self.WatermarkPixmap,
QPixmap(I('welcome_wizard.png')))
self.setPixmap(self.BackgroundPixmap, QPixmap(I('wizard.png')))
self.device_page = DevicePage() self.device_page = DevicePage()
self.library_page = LibraryPage() self.library_page = LibraryPage()
self.library_page.retranslate.connect(self.retranslate) self.library_page.retranslate.connect(self.retranslate)
@ -807,15 +801,8 @@ class Wizard(QWizard):
self.setPage(self.stanza_page.ID, self.stanza_page) self.setPage(self.stanza_page.ID, self.stanza_page)
self.device_extra_page = None self.device_extra_page = None
nh, nw = min_available_height()-75, available_width()-30
if nh < 0:
nh = 580
if nw < 0:
nw = 400
nh = min(400, nh)
nw = min(580, nw)
self.resize(nw, nh)
self.set_button_texts() self.set_button_texts()
self.resize(600, 520)
def set_button_texts(self): def set_button_texts(self):
for but, text in self.BUTTON_TEXTS.iteritems(): for but, text in self.BUTTON_TEXTS.iteritems():