update splash screen

This commit is contained in:
Damien Elmes 2009-03-04 10:09:57 +09:00
parent e979efb96e
commit 9033dd8afc
3 changed files with 27 additions and 6 deletions

View file

@ -29,6 +29,26 @@ sys.path.append(os.path.dirname(__file__))
# 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():
import config
@ -54,14 +74,10 @@ def run():
app = QApplication(sys.argv)
# Create a pixmap - not needed if you have your own.
import forms
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
sys.path.append(modDir)
@ -118,8 +134,9 @@ def run():
# load main window
ui.importAll()
ui.dialogs.registerDialogs()
ui.splash.update()
mw = ui.main.AnkiQt(app, conf, args)
try:
styleFile = open(os.path.join(opts.config, "style.css"))

View file

@ -48,6 +48,7 @@ class AnkiQt(QMainWindow):
self.setupSound()
self.setupTray()
self.connectMenuActions()
ui.splash.update()
if self.config['mainWindowGeom']:
self.restoreGeometry(self.config['mainWindowGeom'])
self.setupViews()
@ -61,10 +62,12 @@ class AnkiQt(QMainWindow):
self.setUnifiedTitleAndToolBarOnMac(True)
pass
# load deck
ui.splash.update()
if not self.maybeLoadLastDeck(args):
self.setEnabled(True)
self.moveToState("auto")
# check for updates
ui.splash.update()
self.setupAutoUpdate()
self.setupErrorHandler()
self.setupMisc()
@ -76,6 +79,7 @@ class AnkiQt(QMainWindow):
except:
ui.utils.showWarning(_("Broken plugin:\n\n%s") %
traceback.format_exc())
ui.splash.update()
ui.splash.finish(self)
self.show()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB