Rewritten dummypythonqt module to work with current API state.

main
Teo Mrnjavac 8 years ago
parent 53f687587b
commit f1d6cc0283

@ -18,30 +18,44 @@
# You should have received a copy of the GNU General Public License
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
import os
from time import gmtime, strftime, sleep
import platform
from PythonQt.QtGui import *
def run():
""" Example Python jobmodule.
A Python jobmodule is a Python program which imports libcalamares and
has a function run() as entry point. run() must return None if everything
went well, or a tuple (str,str) with an error message and description
if something went wrong.
:return:
"""
print("foo bar quux")
os.system("/bin/sh -c \"touch ~/calamares-dummypythonqt\"")
accumulator = strftime("%Y-%m-%d %H:%M:%S", gmtime()) + "\n"
box = QLabel(accumulator)
box.show()
print(accumulator)
# To indicate an error, return a tuple of:
# (message, detailed-error-message)
return None
from PythonQt.calamares import *
# Example Python ViewModule.
# A Python ViewModule is a Python program which defines a ViewStep class.
# This class must be marked with the @calamares_module decorator. A
# ViewModule may define other classes, but only one may be decorated with
# @calamares_module. Such a class must conform to the Calamares ViewStep
# interface and functions as the entry point of the module.
# A ViewStep manages one or more "wizard pages" through methods like
# back/next, and reports its status through isNextEnabled/isBackEnabled/
# isAtBeginning/isAtEnd. The whole UI, including all the pages, must be
# exposed as a single QWidget, returned by the widget function.
@calamares_module
class DummyPythonQtViewStep():
def __init__(self):
self.main_widget = QLabel()
accumulator = "\nCalamares+PythonQt running embedded Python " +\
platform.python_version()
self.main_widget.text = accumulator
def prettyName(self):
return "Dummy PythonQt ViewStep"
def isNextEnabled(self):
return True
def isBackEnabled(self):
return True
def isAtBeginning(self):
return True
def isAtEnd(self):
return True
def widget(self):
return self.main_widget

Loading…
Cancel
Save