Skip to content

Commit

Permalink
Merge pull request #14 from UdK-VPT/clickable_progress_steps
Browse files Browse the repository at this point in the history
Clickable progress steps
  • Loading branch information
firstdayofjune committed Feb 10, 2015
2 parents 6e35638 + 5e93c74 commit 587e2d3
Show file tree
Hide file tree
Showing 17 changed files with 2,849 additions and 3,261 deletions.
2 changes: 1 addition & 1 deletion ExportWMSasTif.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import LayerInteraction


class SaveSelectionWithPyramid:
class ExportWMSasTif:


def __init__(self, iface):
Expand Down
14 changes: 6 additions & 8 deletions InvestigationAreaSelected_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@ def set_dialog_text(self, text, title=""):

if text is not None and not text.isspace():

html_prefix = (
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">\n'
'<html><head><meta name="qrichtext" content="1" /><style type="text/css">\n'
'p, li { white-space: pre-wrap; }\n'
'</style></head><body style=" font-family:\\')

html_postfix = "</p></body></html>"
self.textBrowser.setHtml(html_prefix + text + html_postfix)
html_prefix = ('<p align="center" style=" margin-top:0px; margin-bottom:0px; '
'margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">')

html_postfix = "</p>"
browser_text = html_prefix + text + html_postfix
self.textBrowser.setHtml(QtGui.QApplication.translate('InvestigationAreaSelected_dialog', browser_text, None))
File renamed without changes.
9 changes: 3 additions & 6 deletions LayerInteraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,24 +184,21 @@ def get_wms_layer_list(iface, visibility='all'):
interface = iface.legendInterface()

if visibility == 'visible':
for layer_key in layer_list:
layer = layer_list[layer_key]
for key, layer in layer_list.iteritems():
if layer.type() == QgsMapLayer.RasterLayer and interface.isLayerVisible(layer):
active_wms_layers.append(layer)

return active_wms_layers

elif visibility == 'invisible':
for layer_key in layer_list:
layer = layer_list[layer_key]
for key, layer in layer_list.iteritems():
if layer.type() == QgsMapLayer.RasterLayer and not interface.isLayerVisible(layer):
active_wms_layers.append(layer)

return active_wms_layers

else:
for layer_key in layer_list:
layer = layer_list[layer_key]
for key, layer in layer_list.iteritems():
if layer.type() == QgsMapLayer.RasterLayer:
active_wms_layers.append(layer)

Expand Down
80 changes: 31 additions & 49 deletions MainProcess_dock.py
Original file line number Diff line number Diff line change
@@ -1,82 +1,64 @@
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import SIGNAL
from ui_main_process_dock import Ui_MainProcess_dock, _fromUtf8
from ui_process_button import QProcessButton
from collections import OrderedDict

class MainProcess_dock(QtGui.QDockWidget, Ui_MainProcess_dock):

def __init__(self):
QtGui.QDockWidget.__init__(self)

self.setupUi(self)
self.selection_to_page = {}
self.check_mark = QtGui.QPixmap(_fromUtf8(":/Icons/Icons/checkmark.png"))
self.open_mark = QtGui.QPixmap(_fromUtf8(":/Icons/Icons/openmark.png"))
self.selection_to_page = OrderedDict([])
self._check_mark = QtGui.QPixmap(_fromUtf8(":/Icons/Icons/checkmark.png"))
self._open_mark = QtGui.QPixmap(_fromUtf8(":/Icons/Icons/openmark.png"))

page_triples = []

page_list = []
# put each page-widget in a list of triples, as they are not sorted properly
for page in self.process_page.children():
if type(page) is QtGui.QWidget:
self.selection_to_page[page.accessibleName()] = page
page_list.append(page.accessibleName())
if isinstance(page, QtGui.QWidget):
index = self.process_page.indexOf(page)
page_triples.append((index, page.accessibleName(), page))

page_list.reverse()
page_triples_sorted = sorted(page_triples, key=lambda tup: tup[0])
self.selection_to_page = OrderedDict(map(lambda trip: trip[1:], page_triples_sorted))

for i in range(0, len(page_list)):
self.active_page_dropdown.addItem(page_list[i])
self.active_page_dropdown.setItemData(i, self.open_mark, QtCore.Qt.DecorationRole)

self.active_page_dropdown.currentIndexChanged.connect(lambda: self.go_to_page(self.active_page_dropdown.currentText()))

def set_checkbox_on_page(self, checkbox_name, page_name, check_yes_no):
# add page-names to according position in dropdown-menu, so the user can navigate through the process
for page_number, page in enumerate(self.selection_to_page.keys()):
self.active_page_dropdown.addItem(page)
self.active_page_dropdown.setItemData(page_number, self._open_mark, QtCore.Qt.DecorationRole)

if not checkbox_name or checkbox_name.isspace():
print "A checkbox with the given name " + checkbox_name + " was not found."
self.active_page_dropdown.currentIndexChanged.connect(lambda: self.go_to_page(self.active_page_dropdown.currentText()))

elif not page_name or page_name.isspace():
print "A page with the given name " + page_name + " was not found."
# set the currently displayed widget to the first process-page, otherwise the correct display is not guaranteed
self.process_page.setCurrentWidget(self.selection_to_page.values()[0])

elif type(check_yes_no) is not bool:
print "A boolean check_yes_no has to be passed as a third parameter."
def go_to_page(self, selection_name):
[self.process_page.setCurrentWidget(page)
for page in self.selection_to_page.values() if selection_name == page.accessibleName()]

else:
def set_checkbox_on_page(self, checkbox_name, page_name, check_yes_no):
if isinstance(check_yes_no, bool):
page = self.findChild(QtGui.QWidget, page_name)
checkbox = page.findChild(QtGui.QPushButton, checkbox_name)

if checkbox:
checkbox.setChecked(check_yes_no)

def is_checkbox_on_page_checked(self, checkbox_name, page_name):
page = self.process_page.findChild(QtGui.QWidget, page_name)
return page.findChild(QtGui.QPushButton, checkbox_name).isChecked()

if not checkbox_name or checkbox_name.isspace():
print "A checkbox with the given name " + checkbox_name + " was not found."

elif not page_name or page_name.isspace():
print "A page with the given name " + page_name + " was not found."

else:
page = self.process_page.findChild(QtGui.QWidget, page_name)
return page.findChild(QtGui.QPushButton, checkbox_name).isChecked()

def set_page_done(self, value):

if type(value) is not bool:
print "A boolean value has to be passed as a third parameter."

else:
def set_current_page_done(self, value):
if isinstance(value, bool):
page_name = self.active_page_dropdown.currentText()
page = self.selection_to_page[page_name]

if (page_name) == page.accessibleName():
index = self.active_page_dropdown.currentIndex()
self.active_page_dropdown.setItemData(index, self.check_mark, QtCore.Qt.DecorationRole)
self.active_page_dropdown.setItemData(index, self._check_mark, QtCore.Qt.DecorationRole)
self.active_page_dropdown.setCurrentIndex((index+1) % len(self.selection_to_page))

def go_to_page(self, selection_name):

if selection_name is not None and not selection_name.isspace():

for selection in self.selection_to_page:
page = self.selection_to_page[selection]

if (selection_name) == page.accessibleName():
self.process_page.setCurrentWidget(page)
break

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ PY_FILES = OpenEQuarterMain.py __init__.py

EXTRAS = Icons/icon.png Icons/checkmark.png Icons/openmark.png metadata.txt

UI_FILES = ui_project_does_not_exist_dialog.py ui_request_wms_url_dialog.py ui_investigation_area_selected_dialog.py ui_investigation_area_selected_help_dialog.py ui_mainstay_process_dialog.py ui_main_process_wizard.py ui_main_process_dock.py
UI_FILES = ui_project_does_not_exist_dialog.py ui_request_wms_url_dialog.py ui_investigation_area_selected_dialog.py ui_investigation_area_selected_help_dialog.py ui_main_process_dock.py

RESOURCE_FILES = resources_rc.py

Expand Down
Loading

0 comments on commit 587e2d3

Please sign in to comment.