mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 14:17:13 -05:00
update splash screen
This commit is contained in:
parent
e979efb96e
commit
9033dd8afc
3 changed files with 27 additions and 6 deletions
|
|
@ -29,6 +29,26 @@ sys.path.append(os.path.dirname(__file__))
|
||||||
# App initialisation
|
# App initialisation
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
|
class SplashScreen(object):
|
||||||
|
|
||||||
|
def __init__(self, max=100):
|
||||||
|
self.pixmap = QPixmap(":/icons/anki-logo.png")
|
||||||
|
self.splash = QSplashScreen(self.pixmap)
|
||||||
|
self.prog = QProgressBar(self.splash)
|
||||||
|
self.prog.setMaximum(max)
|
||||||
|
self.prog.setGeometry(self.splash.width()/10, 8*self.splash.height()/10,
|
||||||
|
8*self.splash.width()/10, self.splash.height()/10)
|
||||||
|
self.splash.show()
|
||||||
|
self.val = 1
|
||||||
|
|
||||||
|
def update(self):
|
||||||
|
self.prog.setValue(self.val)
|
||||||
|
self.val += 1
|
||||||
|
QApplication.instance().processEvents()
|
||||||
|
|
||||||
|
def finish(self, obj):
|
||||||
|
self.splash.finish(obj)
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
import config
|
import config
|
||||||
|
|
||||||
|
|
@ -54,14 +74,10 @@ def run():
|
||||||
|
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
# Create a pixmap - not needed if you have your own.
|
|
||||||
import forms
|
import forms
|
||||||
import ui
|
import ui
|
||||||
pixmap = QPixmap(":/icons/anki-logo.png")
|
|
||||||
ui.splash = QSplashScreen(pixmap)
|
|
||||||
ui.splash.show()
|
|
||||||
app.processEvents()
|
|
||||||
|
|
||||||
|
ui.splash = SplashScreen(5)
|
||||||
|
|
||||||
# setup paths for forms, icons
|
# setup paths for forms, icons
|
||||||
sys.path.append(modDir)
|
sys.path.append(modDir)
|
||||||
|
|
@ -118,8 +134,9 @@ def run():
|
||||||
|
|
||||||
# load main window
|
# load main window
|
||||||
ui.importAll()
|
ui.importAll()
|
||||||
|
|
||||||
ui.dialogs.registerDialogs()
|
ui.dialogs.registerDialogs()
|
||||||
|
ui.splash.update()
|
||||||
|
|
||||||
mw = ui.main.AnkiQt(app, conf, args)
|
mw = ui.main.AnkiQt(app, conf, args)
|
||||||
try:
|
try:
|
||||||
styleFile = open(os.path.join(opts.config, "style.css"))
|
styleFile = open(os.path.join(opts.config, "style.css"))
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ class AnkiQt(QMainWindow):
|
||||||
self.setupSound()
|
self.setupSound()
|
||||||
self.setupTray()
|
self.setupTray()
|
||||||
self.connectMenuActions()
|
self.connectMenuActions()
|
||||||
|
ui.splash.update()
|
||||||
if self.config['mainWindowGeom']:
|
if self.config['mainWindowGeom']:
|
||||||
self.restoreGeometry(self.config['mainWindowGeom'])
|
self.restoreGeometry(self.config['mainWindowGeom'])
|
||||||
self.setupViews()
|
self.setupViews()
|
||||||
|
|
@ -61,10 +62,12 @@ class AnkiQt(QMainWindow):
|
||||||
self.setUnifiedTitleAndToolBarOnMac(True)
|
self.setUnifiedTitleAndToolBarOnMac(True)
|
||||||
pass
|
pass
|
||||||
# load deck
|
# load deck
|
||||||
|
ui.splash.update()
|
||||||
if not self.maybeLoadLastDeck(args):
|
if not self.maybeLoadLastDeck(args):
|
||||||
self.setEnabled(True)
|
self.setEnabled(True)
|
||||||
self.moveToState("auto")
|
self.moveToState("auto")
|
||||||
# check for updates
|
# check for updates
|
||||||
|
ui.splash.update()
|
||||||
self.setupAutoUpdate()
|
self.setupAutoUpdate()
|
||||||
self.setupErrorHandler()
|
self.setupErrorHandler()
|
||||||
self.setupMisc()
|
self.setupMisc()
|
||||||
|
|
@ -76,6 +79,7 @@ class AnkiQt(QMainWindow):
|
||||||
except:
|
except:
|
||||||
ui.utils.showWarning(_("Broken plugin:\n\n%s") %
|
ui.utils.showWarning(_("Broken plugin:\n\n%s") %
|
||||||
traceback.format_exc())
|
traceback.format_exc())
|
||||||
|
ui.splash.update()
|
||||||
ui.splash.finish(self)
|
ui.splash.finish(self)
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.7 KiB |
Loading…
Reference in a new issue