def load_gridsys(self): gridsys_name = self.ui.fgdc_gridsysn.currentText() projection = spatial_utils.GRIDSYS_LOOKUP[gridsys_name] annotation_lookup = fgdc_utils.get_fgdc_lookup() layout = self.ui.gridsys_contents.layout() while layout.count(): child = layout.takeAt(0) if child.widget(): child.widget().deleteLater() for param in projection['elements']: try: long_name = annotation_lookup[param]['long_name'] annotation = annotation_lookup[param]['annotation'] except: long_name = param annotation = 'Unknown' label = QLabel(long_name) label.setToolTip(annotation) label.help_text = annotation lineedit = QLineEdit('...') lineedit.setObjectName('fgdc_' + param) lineedit.setToolTip(annotation) layout.addRow(label, lineedit) gridsys_proj = spatial_utils.PROJECTION_LOOKUP[projection['projection']] self.grid_mapproj.load_projection(gridsys_proj['shortname'])
def clear_validation(self): """ Remove the error highlighting from all the error widgets Returns ------- None """ annotation_lookup = fgdc_utils.get_fgdc_lookup() for widget in self.error_widgets: if not sip.isdeleted(widget) and widget.objectName() not in [ "metadata_root", "fgdc_metadata", ]: widget.setStyleSheet("""""") print(widget.objectName()) shortname = widget.objectName().replace("fgdc_", "") if shortname[-1].isdigit(): shortname = shortname[:-1] try: widget.setToolTip(annotation_lookup[shortname]["annotation"]) except KeyError: widget.setToolTip("") self.error_widgets = [] self.error_list.clear_errors() self.error_list_dialog.hide()
def load_projection(self, shortname): self.clear_widget() self.shortname = shortname self.projection = spatial_utils.lookup_shortname(shortname) annotation_lookup = fgdc_utils.get_fgdc_lookup() annotation_lookup["stdparll_2"] = { "long_name": "Standard Parallel", "annotation": annotation_lookup["stdparll"]["annotation"], } self.clear_widget() layout = self.ui.mapproj_contents.layout() for param in self.projection["elements"]: try: long_name = annotation_lookup[param]["long_name"] annotation = annotation_lookup[param]["annotation"] except: long_name = param annotation = "Unknown" label = QLabel(long_name) label.setToolTip(annotation) label.help_text = annotation lineedit = QLineEdit("...") lineedit.setObjectName("fgdc_" + param) lineedit.setToolTip(annotation) layout.addRow(label, lineedit)
def load_projection(self, shortname): self.clear_widget() self.shortname = shortname self.projection = spatial_utils.lookup_shortname(shortname) annotation_lookup = fgdc_utils.get_fgdc_lookup() annotation_lookup['stdparll_2'] = { 'long_name': 'Standard Parallel', 'annotation': annotation_lookup['stdparll']['annotation'] } self.clear_widget() layout = self.ui.mapproj_contents.layout() for param in self.projection['elements']: try: long_name = annotation_lookup[param]['long_name'] annotation = annotation_lookup[param]['annotation'] except: long_name = param annotation = 'Unknown' label = QLabel(long_name) label.setToolTip(annotation) label.help_text = annotation lineedit = QLineEdit('...') lineedit.setObjectName('fgdc_' + param) lineedit.setToolTip(annotation) layout.addRow(label, lineedit)
def populate_tooltips(self): """ For this widget and any child widgets populate the tooltips for any with names that begin with FGDC_ or Help_ Returns ------- None """ annotation_lookup = fgdc_utils.get_fgdc_lookup() if self.objectName().startswith('fgdc_'): self.populate_tooltip(self, annotation_lookup) widgets = self.findChildren(QObject, QRegExp(r'.*')) for widget in widgets: self.populate_tooltip(widget, annotation_lookup)
import time import getpass try: from docx import Document from docx.shared import Inches from docx.shared import Pt from docx.shared import RGBColor from docx.enum.style import WD_STYLE_TYPE except ImportError: docx = None from pymdwizard.core import utils from pymdwizard.core import fgdc_utils FGDC_LOOKUP = fgdc_utils.get_fgdc_lookup() def _get_longname(tag): try: long_name = FGDC_LOOKUP[tag]["long_name"] except KeyError: long_name = tag return long_name def _load_styles(doc): heading1 = doc.styles["Normal"] font = heading1.font font.name = "Times New Roman"