forked from gisquick/gisquick-qgis-plugin-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wizard.py
57 lines (48 loc) · 1.78 KB
/
wizard.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Gisquick plugin
Publish your projects into Gisquick application
***************************************************************************/
"""
class WizardPage(object):
"""Base class for a wizard page of the publishing dialog.
Args:
plugin (webgisplugin.WebGisPlugin): reference to webgis plugin
page (PyQt4.QtGui.QWizardPage): GUI of the wizard page
"""
def __init__(self, plugin, page):
self.plugin = plugin
self.dialog = plugin.dialog
self.initialized = False
self._page = page
self._page.initializePage = self._initialize_page
self._page.validatePage = self.validate
self._page.cleanupPage = self.on_return
### disabled: see #35
# if hasattr(self, "is_complete"):
# self._page.isComplete = self.is_complete
self._page.handler = self
def _initialize_page(self):
if not self.initialized:
self.initialize()
self.initialized = True
self.on_show()
def initialize(self):
"""Method will be called for page initialization (before displayed for the first time)."""
pass
def on_show(self):
"""Method will be called each time this page is displayed (from previous page)."""
pass
def on_return(self):
"""Method will be called on return to a previous page."""
pass
def validate(self):
"""Method to validate page configuration - must evaluate to True to continue with next page.
Returns:
bool: True if page configuration is valid
"""
return True
def before_publish(self):
"""Method called right before publishing project."""
pass