progressbar

This commit is contained in:
Jonathan Corwin 2010-08-26 22:32:31 +01:00
commit ea2419924c
3 changed files with 11 additions and 10 deletions

View File

@ -233,7 +233,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
def getListOfFiles(self, listbox): def getListOfFiles(self, listbox):
files = [] files = []
for row in range(0, listbox.count()): for row in range(0, listbox.count()):
files.append(unicode(listbox.item(row))) files.append(unicode(listbox.item(row).text()))
return files return files
def removeSelectedItems(self, listbox): def removeSelectedItems(self, listbox):
@ -338,7 +338,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
log.debug(u'IncrementBar %s', status_text) log.debug(u'IncrementBar %s', status_text)
self.importProgressLabel.setText(status_text) self.importProgressLabel.setText(status_text)
self.importProgressBar.setValue(self.importProgressBar.value() + 1) self.importProgressBar.setValue(self.importProgressBar.value() + 1)
Receiver.send_message(u'process_events') Receiver.send_message(u'openlp_process_events')
def preImport(self): def preImport(self):
self.finishButton.setVisible(False) self.finishButton.setVisible(False)
@ -347,7 +347,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
self.importProgressBar.setValue(0) self.importProgressBar.setValue(0)
self.importProgressLabel.setText( self.importProgressLabel.setText(
translate('SongsPlugin.ImportWizardForm', 'Starting import...')) translate('SongsPlugin.ImportWizardForm', 'Starting import...'))
Receiver.send_message(u'process_events') Receiver.send_message(u'openlp_process_events')
def performImport(self): def performImport(self):
""" """
@ -411,4 +411,4 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
self.importProgressBar.setValue(self.importProgressBar.maximum()) self.importProgressBar.setValue(self.importProgressBar.maximum())
self.finishButton.setVisible(True) self.finishButton.setVisible(True)
self.cancelButton.setVisible(False) self.cancelButton.setVisible(False)
Receiver.send_message(u'process_events') Receiver.send_message(u'openlp_process_events')

View File

@ -59,6 +59,7 @@ class OooImport(SongImport):
self.document = None self.document = None
self.process_started = False self.process_started = False
self.filenames = kwargs[u'filenames'] self.filenames = kwargs[u'filenames']
self.import_wizard.importProgressBar.setMaximum(0)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlp_stop_song_import'), self.stop_import) QtCore.SIGNAL(u'openlp_stop_song_import'), self.stop_import)
@ -67,7 +68,7 @@ class OooImport(SongImport):
self.start_ooo() self.start_ooo()
for filename in self.filenames: for filename in self.filenames:
if self.abort: if self.abort:
self.wizard.incrementProgressBar(u'Import cancelled') self.import_wizard.incrementProgressBar(u'Import cancelled')
return return
filename = unicode(filename) filename = unicode(filename)
if os.path.isfile(filename): if os.path.isfile(filename):
@ -148,7 +149,7 @@ class OooImport(SongImport):
self.document.supportsService("com.sun.star.text.TextDocument"): self.document.supportsService("com.sun.star.text.TextDocument"):
self.close_ooo_file() self.close_ooo_file()
else: else:
self.wizard.incrementProgressBar(u'Processing file ' + filepath) self.import_wizard.incrementProgressBar(u'Processing file ' + filepath)
except: except:
pass pass
return return
@ -176,7 +177,7 @@ class OooImport(SongImport):
text = u'' text = u''
for slide_no in range(slides.getCount()): for slide_no in range(slides.getCount()):
if self.abort: if self.abort:
self.wizard.incrementProgressBar(u'Import cancelled') self.import_wizard.incrementProgressBar(u'Import cancelled')
return return
slide = slides.getByIndex(slide_no) slide = slides.getByIndex(slide_no)
slidetext = u'' slidetext = u''

View File

@ -80,7 +80,7 @@ class SofImport(OooImport):
self.start_ooo() self.start_ooo()
for filename in self.filenames: for filename in self.filenames:
if self.abort: if self.abort:
self.wizard.incrementProgressBar(u'Import cancelled') self.import_wizard.incrementProgressBar(u'Import cancelled')
return return
filename = unicode(filename) filename = unicode(filename)
if os.path.isfile(filename): if os.path.isfile(filename):
@ -99,7 +99,7 @@ class SofImport(OooImport):
paragraphs = self.document.getText().createEnumeration() paragraphs = self.document.getText().createEnumeration()
while paragraphs.hasMoreElements(): while paragraphs.hasMoreElements():
if self.abort: if self.abort:
self.wizard.incrementProgressBar(u'Import cancelled') self.import_wizard.incrementProgressBar(u'Import cancelled')
return return
paragraph = paragraphs.nextElement() paragraph = paragraphs.nextElement()
if paragraph.supportsService("com.sun.star.text.Paragraph"): if paragraph.supportsService("com.sun.star.text.Paragraph"):
@ -255,7 +255,7 @@ class SofImport(OooImport):
if title.endswith(u','): if title.endswith(u','):
title = title[:-1] title = title[:-1]
self.song.title = title self.song.title = title
self.wizard.incrementProgressBar(u'Processing song ' + title) self.import_wizard.incrementProgressBar(u'Processing song ' + title)
def add_author(self, text): def add_author(self, text):
""" """