Skip to content
Snippets Groups Projects
Commit f1d6cc02 authored by Teo Mrnjavac's avatar Teo Mrnjavac
Browse files

Rewritten dummypythonqt module to work with current API state.

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