本文整理汇总了Python中safe_qgis.safe_interface.get_version函数的典型用法代码示例。如果您正苦于以下问题:Python get_version函数的具体用法?Python get_version怎么用?Python get_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_version函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent=None):
"""Constructor for the dialog.
Show the grid converter dialog.
:param parent: parent - widget to use as parent.
:type parent: QWidget
"""
QDialog.__init__(self, parent)
self.parent = parent
self.setupUi(self)
self.setWindowTitle(self.tr('InaSAFE %s Converter') % (
get_version()))
self.warning_text = set()
self.on_input_path_textChanged()
self.on_output_path_textChanged()
self.update_warning()
# Event register
#noinspection PyUnresolvedReferences
self.use_output_default.toggled.connect(
self.get_output_from_input)
#noinspection PyUnresolvedReferences
self.input_path.textChanged.connect(self.on_input_path_textChanged)
#noinspection PyUnresolvedReferences
self.output_path.textChanged.connect(self.on_output_path_textChanged)
# Set up things for context help
help_button = self.button_box.button(QDialogButtonBox.Help)
help_button.clicked.connect(self.show_help)
self.show_info()
示例2: __init__
def __init__(self, iface, dock=None, parent=None):
"""Constructor for the dialog.
:param iface: A Quantum GIS QGisAppInterface instance.
:type iface: QGisAppInterface
:param parent: Parent widget of this dialog
:type parent: QWidget
:param dock: Optional dock widget instance that we can notify of
changes to the keywords.
:type dock: Dock
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.setWindowTitle(self.tr('InaSAFE %s Options' % get_version()))
# Save reference to the QGIS interface and parent
self.iface = iface
self.parent = parent
self.dock = dock
self.keywordIO = KeywordIO()
# Set up things for context help
myButton = self.buttonBox.button(QtGui.QDialogButtonBox.Help)
myButton.clicked.connect(self.show_help)
self.grpNotImplemented.hide()
self.adjustSize()
self.restore_state()
# hack prevent showing use thread visible and set it false see #557
self.cbxUseThread.setChecked(True)
self.cbxUseThread.setVisible(False)
示例3: __init__
def __init__(self, parent=None):
"""Constructor for the dialog.
Show the grid converter dialog.
:param parent: parent - widget to use as parent.
:type parent: QWidget
"""
QDialog.__init__(self, parent)
self.parent = parent
self.setupUi(self)
self.setWindowTitle(self.tr('InaSAFE %1 Converter').arg(
get_version()))
self.warning_text = set()
self.on_leInputPath_textChanged()
self.on_leOutputPath_textChanged()
self.update_warning()
# Event register
QObject.connect(self.cBDefaultOutputLocation,
SIGNAL('toggled(bool)'),
self.get_output_from_input)
QObject.connect(self.leInputPath,
SIGNAL('textChanged(QString)'),
self.on_leInputPath_textChanged)
QObject.connect(self.leOutputPath,
SIGNAL('textChanged(QString)'),
self.on_leOutputPath_textChanged)
self.show_info()
示例4: __init__
def __init__(self, parent=None):
"""Constructor for the dialog.
:param parent: Parent widget of this dialog
:type parent: QWidget
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.setWindowTitle(self.tr('About InaSAFE %s' % get_version()))
self.parent = parent
# Set Limitations Text
limitations_text = ''
for index, limitation in enumerate(limitations()):
limitations_text += '%s. %s \n' % (index + 1, limitation)
self.limitations_text.setFontPointSize(11)
self.limitations_text.setText(limitations_text)
# Set Disclaimer Text
self.disclaimer_text.setFontPointSize(11)
self.disclaimer_text.setText(disclaimer())
# Set Attributions text
image_credits_text = ''
for index, limitation in enumerate(self.attributions()):
image_credits_text += '%s. %s \n' % (index + 1, limitation)
self.image_credits_text.setFontPointSize(11)
self.image_credits_text.setText(image_credits_text)
示例5: __init__
def __init__(self, parent, iface, theDock=None):
"""Constructor for the dialog.
Args:
* parent - parent widget of this dialog
* iface - a Quantum GIS QGisAppInterface instance.
* theDock - Optional dock widget instance that we can notify of
changes to the keywords.
Returns:
not applicable
Raises:
no exceptions explicitly raised
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.setWindowTitle(self.tr('InaSAFE %s Options' % get_version()))
# Save reference to the QGIS interface and parent
self.iface = iface
self.parent = parent
self.dock = theDock
self.helpDialog = None
self.keywordIO = KeywordIO()
# Set up things for context help
myButton = self.buttonBox.button(QtGui.QDialogButtonBox.Help)
QtCore.QObject.connect(myButton, QtCore.SIGNAL('clicked()'),
self.showHelp)
self.grpNotImplemented.hide()
self.adjustSize()
self.restoreState()
# hack prevent showing use thread visible and set it false see #557
self.cbxUseThread.setChecked(True)
self.cbxUseThread.setVisible(False)
示例6: __init__
def __init__(self, parent=None, dict_filter=None):
"""Constructor for the dialog.
This dialog will show the user impact function documentation.
:param parent: Optional widget to use as parent
:type parent: QWidget
:param dict_filter: Optional filter to use to limit which functions
are show to the user. See below.
:type dict_filter: dict
Example dict_filter::
{'id': [],
'title': [],
'category': [],
'subcategory': [],
'layertype': [],
'datatype': [],
'unit': []}
"""
QtGui.QDialog.__init__(self, parent)
# Set up the user interface from Designer.
self.setupUi(self)
self.setWindowTitle(
self.tr('InaSAFE %s Impact Functions Browser') % (get_version()))
self.parent = parent
self.no_filter = self.tr('No Filter')
if dict_filter is None:
dict_filter = {
'id': [],
'title': [],
'category': [],
'subcategory': [],
'layertype': [],
'datatype': [],
'unit': []}
self.dict_filter = dict_filter
self.table = None # for storing impact functions table
self.show_table()
self.combo_box_content = None # for storing combo box content
self.populate_combo_box()
resetButton = self.myButtonBox.button(QtGui.QDialogButtonBox.Reset)
resetButton.clicked.connect(self.reset_button_clicked)
helpButton = self.myButtonBox.button(QtGui.QDialogButtonBox.Help)
helpButton.clicked.connect(self.show_help)
# Combo box change event
self.comboBox_id.currentIndexChanged.connect(self.update_table)
self.comboBox_title.currentIndexChanged.connect(self.update_table)
self.comboBox_category.currentIndexChanged.connect(self.update_table)
self.comboBox_subcategory.currentIndexChanged.connect(
self.update_table)
self.comboBox_layertype.currentIndexChanged.connect(self.update_table)
self.comboBox_datatype.currentIndexChanged.connect(self.update_table)
self.comboBox_unit.currentIndexChanged.connect(self.update_table)
示例7: drawHostAndTime
def drawHostAndTime(self, theTopOffset):
"""Add a disclaimer to the composition.
Args:
theTopOffset - vertical offset at which to begin drawing
Returns:
None
Raises:
None
"""
LOGGER.debug('InaSAFE Map drawDisclaimer called')
#elapsed_time: 11.612545
#user: timlinux
#host_name: ultrabook
#time_stamp: 2012-10-13_23:10:31
#myUser = self.keywordIO.readKeywords(self.layer, 'user')
#myHost = self.keywordIO.readKeywords(self.layer, 'host_name')
myDateTime = self.keywordIO.readKeywords(self.layer, 'time_stamp')
myTokens = myDateTime.split('_')
myDate = myTokens[0]
myTime = myTokens[1]
#myElapsedTime = self.keywordIO.readKeywords(self.layer,
# 'elapsed_time')
#myElapsedTime = humaniseSeconds(myElapsedTime)
myLongVersion = get_version()
myTokens = myLongVersion.split('.')
myVersion = '%s.%s.%s' % (myTokens[0], myTokens[1], myTokens[2])
myLabelText = self.tr('Date and time of assessment: %1 %2\n'
'Special note: This assessment is a guide - we '
'strongly recommend that you ground truth the '
'results shown here before deploying resources '
'and / or personnel.\n'
'Assessment carried out using InaSAFE release '
'%3 (QGIS plugin version).').arg(
myDate).arg(myTime).arg(myVersion)
myFontSize = 6
myFontWeight = QtGui.QFont.Normal
myItalicsFlag = True
myFont = QtGui.QFont('verdana',
myFontSize,
myFontWeight,
myItalicsFlag)
myLabel = QgsComposerLabel(self.composition)
myLabel.setFont(myFont)
myLabel.setText(myLabelText)
myLabel.adjustSizeToText()
myLabelHeight = 50.0 # mm determined using qgis map composer
myLabelWidth = (self.pageWidth / 2) - self.pageMargin
myLeftOffset = self.pageWidth / 2 # put in right half of page
myLabel.setItemPosition(myLeftOffset,
theTopOffset,
myLabelWidth,
myLabelHeight,
)
myLabel.setFrame(self.showFramesFlag)
self.composition.addItem(myLabel)
示例8: __init__
def __init__(self, parent=None):
"""Constructor for the dialog.
:param parent: Parent widget of this dialog
:type parent: QWidget
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.setWindowTitle(self.tr('About InaSAFE %s' % get_version()))
self.parent = parent
示例9: draw_host_and_time
def draw_host_and_time(self, top_offset):
"""Add a note with hostname and time to the composition.
:param top_offset: Vertical offset at which the logo should be drawn.
:type top_offset: int
"""
LOGGER.debug('InaSAFE Map drawDisclaimer called')
#elapsed_time: 11.612545
#user: timlinux
#host_name: ultrabook
#time_stamp: 2012-10-13_23:10:31
#myUser = self.keyword_io.readKeywords(self.layer, 'user')
#myHost = self.keyword_io.readKeywords(self.layer, 'host_name')
date_time = self.keyword_io.read_keywords(self.layer, 'time_stamp')
tokens = date_time.split('_')
date = tokens[0]
time = tokens[1]
#myElapsedTime = self.keyword_io.readKeywords(self.layer,
# 'elapsed_time')
#myElapsedTime = humaniseSeconds(myElapsedTime)
long_version = get_version()
tokens = long_version.split('.')
version = '%s.%s.%s' % (tokens[0], tokens[1], tokens[2])
label_text = self.tr(
'Date and time of assessment: %s %s\n'
'Special note: This assessment is a guide - we strongly recommend '
'that you ground truth the results shown here before deploying '
'resources and / or personnel.\n'
'Assessment carried out using InaSAFE release %s (QGIS '
'plugin version).') % (date, time, version)
font_size = 6
font_weight = QtGui.QFont.Normal
italics_flag = True
font = QtGui.QFont(
'verdana',
font_size,
font_weight,
italics_flag)
label = QgsComposerLabel(self.composition)
label.setFont(font)
label.setText(label_text)
label.adjustSizeToText()
label_height = 50.0 # mm determined using qgis map composer
label_width = (self.page_width / 2) - self.page_margin
left_offset = self.page_width / 2 # put in right half of page
label.setItemPosition(
left_offset,
top_offset,
label_width,
label_height,)
label.setFrameEnabled(self.show_frames)
self.composition.addItem(label)
示例10: __init__
def __init__(self, parent=None):
"""Constructor for the minimum needs dialog.
:param parent: Parent widget of this dialog.
:type parent: QWidget
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.setWindowTitle(self.tr(
'InaSAFE %1 Minimum Needs Tool').arg(get_version()))
self.polygon_layers_to_combo()
self.show_info()
示例11: __init__
def __init__(self, theParent=None, dict_filter=None):
"""Constructor for the dialog.
This dialog will show the user impact function documentation.
Args:
* theParent - Optional widget to use as parent
Returns:
not applicable
Raises:
no exceptions explicitly raised
"""
QtGui.QDialog.__init__(self, theParent)
self.parent = theParent
self.header = None # for storing html header template
self.footer = None # for storing html footer template
# Set up the user interface from Designer.
self.setupUi(self)
self.setWindowTitle(self.tr("InaSAFE %1 Impact Functions Browser").arg(get_version()))
self.no_filter = self.tr("No Filter")
if dict_filter is None:
dict_filter = {
"id": [],
"title": [],
"category": [],
"subcategory": [],
"layertype": [],
"datatype": [],
"unit": [],
}
self.dict_filter = dict_filter
self.if_table = None # for storing impact functions table
self.showImpactFunctionsTable()
self.combo_box_content = None # for storing combo box content
self.populate_combo_box()
resetButton = self.myButtonBox.button(QtGui.QDialogButtonBox.Reset)
QtCore.QObject.connect(resetButton, QtCore.SIGNAL("clicked()"), self.reset_button_clicked)
# Set up help dialog showing logic.
self.helpDialog = None
helpButton = self.myButtonBox.button(QtGui.QDialogButtonBox.Help)
QtCore.QObject.connect(helpButton, QtCore.SIGNAL("clicked()"), self.showHelp)
# Combo box change event
QtCore.QObject.connect(self.comboBox_id, QtCore.SIGNAL("currentIndexChanged(int)"), self.update_table)
QtCore.QObject.connect(self.comboBox_title, QtCore.SIGNAL("currentIndexChanged(int)"), self.update_table)
QtCore.QObject.connect(self.comboBox_category, QtCore.SIGNAL("currentIndexChanged(int)"), self.update_table)
QtCore.QObject.connect(self.comboBox_subcategory, QtCore.SIGNAL("currentIndexChanged(int)"), self.update_table)
QtCore.QObject.connect(self.comboBox_layertype, QtCore.SIGNAL("currentIndexChanged(int)"), self.update_table)
QtCore.QObject.connect(self.comboBox_datatype, QtCore.SIGNAL("currentIndexChanged(int)"), self.update_table)
QtCore.QObject.connect(self.comboBox_unit, QtCore.SIGNAL("currentIndexChanged(int)"), self.update_table)
示例12: __init__
def __init__(self, parent=None):
"""Constructor for the minimum needs dialog.
:param parent: Parent widget of this dialog.
:type parent: QWidget
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.setWindowTitle(self.tr(
'InaSAFE %s Minimum Needs Tool' % get_version()))
self.polygon_layers_to_combo()
self.show_info()
help_button = self.button_box.button(QtGui.QDialogButtonBox.Help)
help_button.clicked.connect(self.show_help)
示例13: __init__
def __init__(self, parent):
"""Constructor for the dialog.
Args:
* parent - parent widget of this dialog.
* iface - a Quantum GIS QGisAppInterface instance.
Returns:
not applicable.
Raises:
no exceptions explicitly raised.
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.setWindowTitle(self.tr("InaSAFE %1 Minimum Needs Tool").arg(get_version()))
self.polygonLayersToCombo()
示例14: __init__
def __init__(self, theParent=None):
"""Constructor for the dialog.
This dialog will show the user converter dialog
Args:
* theParent - Optional widget to use as parent
Returns:
not applicable
Raises:
no exceptions explicitly raised
"""
QDialog.__init__(self, theParent)
self.parent = theParent
self.setupUi(self)
self.setWindowTitle(self.tr('InaSAFE %1 Converter').arg(
get_version()))
# I'm too lazy to put a text :)
# self.leInputPath.setText('/home/sunnii/Downloads/grid.xml')
self.list_algorithm = ['Nearest', 'Invdist']
self.test_mode = False
self.populate_algorithm()
self.warning_text = set()
self.on_leInputPath_textChanged()
self.on_leOutputPath_textChanged()
self.update_warning()
# Event register
QObject.connect(self.cBDefaultOutputLocation,
SIGNAL('toggled(bool)'),
self.get_output_from_input)
QObject.connect(self.leInputPath,
SIGNAL('textChanged(QString)'),
self.on_leInputPath_textChanged)
QObject.connect(self.leOutputPath,
SIGNAL('textChanged(QString)'),
self.on_leOutputPath_textChanged)
示例15: impact_attribution
def impact_attribution(keywords, inasafe_flag=False):
"""Make a little table for attribution of data sources used in impact.
:param keywords: A keywords dict for an impact layer.
:type keywords: dict
:param inasafe_flag: bool - whether to show a little InaSAFE promotional
text in the attribution output. Defaults to False.
:returns: An html snippet containing attribution information for the impact
layer. If no keywords are present or no appropriate keywords are
present, None is returned.
:rtype: str
"""
if keywords is None:
return None
myJoinWords = ' - %s ' % tr('sourced from')
myHazardDetails = tr('Hazard details')
myHazardTitleKeyword = 'hazard_title'
myHazardSourceKeyword = 'hazard_source'
myExposureDetails = tr('Exposure details')
myExposureTitleKeyword = 'exposure_title'
myExposureSourceKeyword = 'exposure_source'
if myHazardTitleKeyword in keywords:
# We use safe translation infrastructure for this one (rather than Qt)
myHazardTitle = safeTr(keywords[myHazardTitleKeyword])
else:
myHazardTitle = tr('Hazard layer')
if myHazardSourceKeyword in keywords:
# We use safe translation infrastructure for this one (rather than Qt)
myHazardSource = safeTr(keywords[myHazardSourceKeyword])
else:
myHazardSource = tr('an unknown source')
if myExposureTitleKeyword in keywords:
myExposureTitle = keywords[myExposureTitleKeyword]
else:
myExposureTitle = tr('Exposure layer')
if myExposureSourceKeyword in keywords:
myExposureSource = keywords[myExposureSourceKeyword]
else:
myExposureSource = tr('an unknown source')
myReport = m.Message()
myReport.add(m.Heading(myHazardDetails, **INFO_STYLE))
myReport.add(m.Paragraph(
myHazardTitle,
myJoinWords,
myHazardSource))
myReport.add(m.Heading(myExposureDetails, **INFO_STYLE))
myReport.add(m.Paragraph(
myExposureTitle,
myJoinWords,
myExposureSource))
if inasafe_flag:
myReport.add(m.Heading(tr('Software notes'), **INFO_STYLE))
myInaSAFEPhrase = tr(
'This report was created using InaSAFE version %1. Visit '
'http://inasafe.org to get your free copy of this software!'
'InaSAFE has been jointly developed by BNPB, AusAid/AIFDRR & the '
'World Bank').arg(get_version())
myReport.add(m.Paragraph(m.Text(myInaSAFEPhrase)))
return myReport