[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice
From: Sebastian Sauer <mail () dipe ! org>
Date: 2006-10-28 5:37:47
Message-ID: 1162013867.475021.769.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 599670 by sebsauer:
Display progressbar during export.
M +22 -8 kspread/plugins/scripting/scripts/exporthtml.py
M +17 -0 libs/kross/modules/form.cpp
M +10 -0 libs/kross/modules/form.h
--- trunk/koffice/kspread/plugins/scripting/scripts/exporthtml.py #599669:599670
@@ -62,7 +62,7 @@
return True
def setFile(self, filename):
self.filename = filename
- def openFile(self):
+ def openFile(self, progress = None):
self.records = [
['A1','A2','A3','A4'],
['B1','B2','B3','B4'],
@@ -98,9 +98,9 @@
import datetime
# default filename is empty
- self.filename = ''
+ #self.filename = ''
# use following for testing to access direct the OpenDocument \
Spreadsheet File without saveas-dialog.
- #self.filename = '/home/kde4/kspreaddocument.ods'
+ self.filename = '/home/kde4/kspreaddocument.ods'
if self.embeddedInKSpread:
pass
@@ -144,7 +144,7 @@
raise "No such file \"%s\" to read from." % filename
self.filename = path
- def openFile(self):
+ def openFile(self, progress = None):
if not self.embeddedInKSpread:
file = self.extractFileFromUrl( self.filename )
docfile = self.extractFileFromUrl( self.document.url() )
@@ -160,6 +160,10 @@
self.sheet = self.kspread.sheetByName( sheetnames[0] )
self.rowidx = 0
print "Reader.openFile file=%s rowidx=%i maxRow=%i maxColumn=%i" % \
(self.filename, self.rowidx, self.sheet.maxRow(), self.sheet.maxColumn()) + \
self.progress = progress + if self.progress:
+ self.progress.labelText = "Processing sheet \"%s\"" % sheetnames[0]
+ self.progress.maximum = self.sheet.maxRow()
def closeFile(self):
pass
@@ -175,6 +179,8 @@
if value or len(record) > 0:
record.insert(0,value)
self.rowidx += 1
+ if self.progress:
+ self.progress.value = self.rowidx
return record
print "EXPORT DONE rowidx=%i maxRow=%i maxColumn=%i" % (self.rowidx, \
self.sheet.maxRow(), self.sheet.maxColumn()) return None
@@ -358,6 +364,12 @@
def showError(self, message):
self.forms.showMessageBox("Error", "Error", message)
+ def showProgress(self):
+ progress = self.forms.showProgressDialog("Exporting...", "Initialize...")
+ progress.value = 0
+ #progress.labelText = "blaaaaaaaaaaa"
+ return progress
+
class Exporter:
def __init__(self, scriptaction):
@@ -384,17 +396,19 @@
# print "Using active window"
global Dialog
- dialog = Dialog(self)
+ self.dialog = Dialog(self)
while True:
try:
- if dialog.show():
+ if self.dialog.show():
self.doExport()
break
except:
- dialog.showError(sys.exc_info()[0])
+ self.dialog.showError(sys.exc_info()[0])
def doExport(self):
- self.reader.openFile()
+ progress = self.dialog.showProgress()
+
+ self.reader.openFile(progress)
self.writer.openFile()
while True:
--- trunk/koffice/libs/kross/modules/form.cpp #599669:599670
@@ -30,6 +30,7 @@
#include <QVBoxLayout>
#include <QSizePolicy>
#include <QApplication>
+#include <QProgressDialog>
#include <QtDesigner/QFormBuilder>
#include <kdebug.h>
@@ -413,6 +414,22 @@
}
}
+QWidget* FormModule::showProgressDialog(const QString& caption, const QString& \
labelText) +{
+ QProgressDialog* progress = new QProgressDialog();
+ //progress->setWindowModality(Qt::WindowModal);
+ progress->setModal(true);
+ progress->setWindowTitle(caption);
+ progress->setLabelText(labelText);
+ progress->setAutoClose(true);
+ progress->setAutoReset(true);
+ progress->setCancelButtonText(QString());
+ progress->setMinimumWidth(300);
+ progress->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, \
QSizePolicy::Expanding)); + progress->show();
+ return progress;
+}
+
QWidget* FormModule::createDialog(const QString& caption)
{
return new FormDialog(caption);
--- trunk/koffice/libs/kross/modules/form.h #599669:599670
@@ -232,6 +232,16 @@
QString showMessageBox(const QString& dialogtype, const QString& \
caption, const QString& message);
/**
+ * Show a progressdialog to provide visible feedback on the progress
+ * of a slow operation.
+ *
+ * \param caption The caption the progressdialog displays.
+ * \param labelText The displayed label.
+ * \return The QProgressDialog widget instance.
+ */
+ QWidget* showProgressDialog(const QString& caption, const QString& \
labelText); +
+ /**
* Create and return a new \a FormDialog instance.
*
* \param caption The displayed caption of the dialog.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic