Center progress dialogs on update to keep from drifting due to growth
git-svn-id: http://comictagger.googlecode.com/svn/trunk@423 6c5673fe-1810-88d6-992b-cd32ca31540c
This commit is contained in:
parent
22867bc9e6
commit
ec010f29e8
@ -189,6 +189,7 @@ class FileSelectionList(QWidget):
|
||||
break
|
||||
progdialog.setValue(idx)
|
||||
progdialog.setLabelText(f)
|
||||
utils.centerWindowOnScreen( progdialog )
|
||||
QCoreApplication.processEvents()
|
||||
row = self.addPathItem( f )
|
||||
if firstAdded is None and row is not None:
|
||||
|
@ -392,6 +392,7 @@ class TaggerWindow( QtGui.QMainWindow):
|
||||
progdialog.setValue(prog_idx)
|
||||
prog_idx += 1
|
||||
progdialog.setLabelText( ca.path )
|
||||
utils.centerWindowOnScreen( progdialog )
|
||||
QtCore.QCoreApplication.processEvents()
|
||||
|
||||
original_path = os.path.abspath( ca.path )
|
||||
@ -1392,6 +1393,7 @@ class TaggerWindow( QtGui.QMainWindow):
|
||||
progdialog.setValue(prog_idx)
|
||||
prog_idx += 1
|
||||
progdialog.setLabelText( ca.path )
|
||||
utils.centerWindowOnScreen( progdialog )
|
||||
QtCore.QCoreApplication.processEvents()
|
||||
|
||||
if ca.hasMetadata( style ) and ca.isWritable():
|
||||
@ -1468,6 +1470,7 @@ class TaggerWindow( QtGui.QMainWindow):
|
||||
progdialog.setValue(prog_idx)
|
||||
prog_idx += 1
|
||||
progdialog.setLabelText( ca.path )
|
||||
utils.centerWindowOnScreen( progdialog )
|
||||
QtCore.QCoreApplication.processEvents()
|
||||
|
||||
if ca.hasMetadata( src_style ) and ca.isWritable():
|
||||
@ -1667,6 +1670,7 @@ class TaggerWindow( QtGui.QMainWindow):
|
||||
self.atprogdialog.progressBar.setValue( prog_idx )
|
||||
prog_idx += 1
|
||||
self.atprogdialog.label.setText( ca.path )
|
||||
utils.centerWindowOnScreen( self.atprogdialog )
|
||||
QtCore.QCoreApplication.processEvents()
|
||||
|
||||
if ca.isWritable():
|
||||
|
18
utils.py
18
utils.py
@ -532,5 +532,21 @@ if qt_available:
|
||||
f = widget.font()
|
||||
if f.pointSize() > 10:
|
||||
f.setPointSize( f.pointSize() - delta )
|
||||
widget.setFont( f )
|
||||
widget.setFont( f )
|
||||
|
||||
def centerWindowOnScreen( window ):
|
||||
"""
|
||||
Center the window on screen. This implemention will handle the window
|
||||
being resized or the screen resolution changing.
|
||||
"""
|
||||
# Get the current screens' dimensions...
|
||||
screen = QtGui.QDesktopWidget().screenGeometry()
|
||||
# ... and get this windows' dimensions
|
||||
mysize = window.geometry()
|
||||
# The horizontal position is calulated as screenwidth - windowwidth /2
|
||||
hpos = ( screen.width() - window.width() ) / 2
|
||||
# And vertical position the same, but with the height dimensions
|
||||
vpos = ( screen.height() - window.height() ) / 2
|
||||
# And the move call repositions the window
|
||||
window.move(hpos, vpos)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user