summaryrefslogtreecommitdiffstats
path: root/displayconfig/servertestdialog.py
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-03-13 05:43:39 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-03-13 05:43:39 +0000
commit19ae07d0d443ff8b777f46bcbe97119483356bfd (patch)
treedae169167c23ba7c61814101995de21d6abac2e8 /displayconfig/servertestdialog.py
downloadtde-guidance-19ae07d0d443ff8b777f46bcbe97119483356bfd.tar.gz
tde-guidance-19ae07d0d443ff8b777f46bcbe97119483356bfd.zip
Added KDE3 version of KDE Guidance utilities
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kde-guidance@1102646 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'displayconfig/servertestdialog.py')
-rwxr-xr-xdisplayconfig/servertestdialog.py113
1 files changed, 113 insertions, 0 deletions
diff --git a/displayconfig/servertestdialog.py b/displayconfig/servertestdialog.py
new file mode 100755
index 0000000..2095522
--- /dev/null
+++ b/displayconfig/servertestdialog.py
@@ -0,0 +1,113 @@
+#!/usr/bin/python
+###########################################################################
+# servertestdialog.py - #
+# ------------------------------ #
+# copyright : (C) 2004 by Simon Edwards #
+# email : simon@simonzone.com #
+# #
+###########################################################################
+# #
+# This program is free software; you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation; either version 2 of the License, or #
+# (at your option) any later version. #
+# #
+###########################################################################
+from qt import * # Just use Qt for this.
+import os
+import sys
+
+############################################################################
+class ServerTestDialog(QDialog):
+ def __init__(self):
+ QDialog.__init__(self)
+
+ msec = 10000
+ margin = 4
+ spacing = 4
+
+ self.totaltimer = QTimer(self)
+ self.updatetimer = QTimer(self)
+ self.msectotal = self.msecremaining = msec
+ self.updateinterval = 1000
+
+ self.connect(self.totaltimer, SIGNAL("timeout()"), self.slotInternalTimeout)
+ self.connect(self.updatetimer, SIGNAL("timeout()"), self.slotUpdateTime)
+
+ layout = QHBoxLayout(self)
+ # create the widgets
+ self.mainwidget = QVBox(self, "mainWidget")
+ self.mainwidget.setMargin(margin)
+ self.mainwidget.setSpacing(spacing)
+
+ layout.addWidget(self.mainwidget,1)
+
+ label = QLabel(self.mainwidget)
+ label.setText(i18n("Are these settings acceptable?"))
+ QWidget(self.mainwidget)
+
+ self.timerwidget = QHBox(self.mainwidget, "timerWidget")
+ self.timerlabel = QLabel(self.timerwidget)
+ self.timerprogress = QProgressBar(self.timerwidget)
+ self.timerprogress.setTotalSteps(self.msectotal)
+ self.timerprogress.setPercentageVisible(False)
+
+ hbox = QHBox(self.mainwidget)
+ self.okbutton = QPushButton(i18n("Yes"),hbox)
+ QWidget(hbox)
+ self.cancelbutton = QPushButton(i18n("No"),hbox)
+ self.connect(self.okbutton, SIGNAL("clicked()"), self.slotOk)
+ self.connect(self.cancelbutton, SIGNAL("clicked()"), self.slotCancel)
+
+ self.slotUpdateTime(False)
+
+ def show(self):
+ QDialog.show(self)
+ self.totaltimer.start(self.msectotal, True)
+ self.updatetimer.start(self.updateinterval, False)
+
+ def exec_loop(self):
+ self.totaltimer.start(self.msectotal, True)
+ self.updatetimer.start(self.updateinterval, False)
+ return QDialog.exec_loop(self)
+
+ def setRefreshInterval(self, msec):
+ self.updateinterval = msec;
+ if self.updatetimer.isActive():
+ self.updatetimer.changeInterval(self.updateinterval)
+
+ def timeoutButton(self):
+ return self.buttonontimeout
+
+ def setTimeoutButton(self, newbutton):
+ self.buttonontimeout = newbutton
+
+ def slotUpdateTime(self, update=True):
+ self.msecremaining -= self.updateinterval
+
+ self.timerprogress.setProgress(self.msecremaining)
+ self.timerlabel.setText( i18n("Automatically cancelling in %1 seconds:").arg(self.msecremaining/1000.0) )
+
+ def slotInternalTimeout(self):
+ self.reject()
+
+ def slotOk(self):
+ self.accept()
+
+ def slotCancel(self):
+ self.reject()
+############################################################################
+
+os.environ["DISPLAY"] = ":9"
+os.environ["XAUTHORITY"] = sys.argv[1]
+
+# FIXME set the application name / string catalog, for i18n().
+qapp = QApplication(sys.argv)
+dialog = ServerTestDialog()
+dialog.show()
+dialog.exec_loop()
+
+if dialog.result()==QDialog.Accepted:
+ sys.exit(0)
+else:
+ sys.exit(1)