本文整理汇总了Python中util.Util.resolve方法的典型用法代码示例。如果您正苦于以下问题:Python Util.resolve方法的具体用法?Python Util.resolve怎么用?Python Util.resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类util.Util
的用法示例。
在下文中一共展示了Util.resolve方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CKANBrowserDialogDisclaimer
# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import resolve [as 别名]
class CKANBrowserDialogDisclaimer(QtGui.QDialog, FORM_CLASS):
def __init__(self, settings, parent=None):
"""Constructor."""
super(CKANBrowserDialogDisclaimer, self).__init__(parent)
# Set up the user interface from Designer.
# After setupUI you can access any designer object by doing
# self.<objectname>, and you can use autoconnect slots - see
# http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
# #widgets-and-dialogs-with-auto-connect
self.setModal(True)
self.setupUi(self)
self.main_win = parent
self.settings = settings
self.util = Util(self.settings, self.main_win)
logo_path = self.util.resolve(u'ckan_logo_big.png')
self.IDC_lblLogo.setPixmap(QtGui.QPixmap(logo_path))
self.IDC_brInfo.setOpenExternalLinks(True)
self.IDC_brInfo.setHtml(self.util.tr('py_disc_info_html'))
示例2: CKANBrowserDialog
# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import resolve [as 别名]
class CKANBrowserDialog(QtGui.QDialog, FORM_CLASS):
def __init__(self, settings, iface, parent=None):
"""Constructor."""
super(CKANBrowserDialog, self).__init__(parent)
# Set up the user interface from Designer.
# After setupUI you can access any designer object by doing
# self.<objectname>, and you can use autoconnect slots - see
# http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
# #widgets-and-dialogs-with-auto-connect
self.setupUi(self)
self.iface = iface
self.main_win = parent
self.search_txt = ''
self.cur_package = None
self.result_count = 0
self.current_page = 1
self.page_count = 0
self.current_group = None
# TODO:
# * create settings dialog
# * read SETTINGS
self.settings = settings
self.util = Util(self.settings, self.main_win)
self.IDC_lblApiUrl.setText(self.util.tr('py_dlg_base_server') + self.settings.ckan_url)
self.IDC_lblCacheDir.setText(self.util.tr('py_dlg_base_cache_path') + self.settings.cache_dir)
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# TODO: automatically populate version
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!111
self.IDC_lblVersion.setText(self.util.tr('py_dlg_base_version').format(self.settings.version))
self.IDC_lblSuchergebnisse.setText(self.util.tr('py_dlg_base_search_result'))
self.IDC_lblPage.setText(self.util.tr('py_dlg_base_page_1_1'))
icon_path = self.util.resolve(u'icon-copy.png')
self.IDC_bCopy.setIcon(QtGui.QIcon(icon_path))
self.cc = CkanConnector(self.settings, self.util)
self.timer = QTimer()
self.timer.setSingleShot(True)
self.timer.timeout.connect(self.window_loaded)
QApplication.setOverrideCursor(Qt.WaitCursor)
def showEvent(self, event):
self.util.msg_log('showevent')
QDialog.showEvent(self, event)
if self.timer is not None:
self.timer.start(500)
self.util.msg_log('showevent finished')
def window_loaded(self):
try:
self.util.msg_log('window_loaded')
self.util.msg_log('before stop')
self.timer.stop()
self.timer = None
self.util.msg_log('before get_groupds')
ok, result = self.cc.get_groups()
if ok is False:
QApplication.restoreOverrideCursor()
self.util.dlg_warning(result)
return
if not result:
self.list_all_clicked()
else:
for entry in result:
item = QListWidgetItem(entry['display_name'])
item.setData(Qt.UserRole, entry)
#item.setCheckState(Qt.Checked)
item.setCheckState(Qt.Unchecked)
self.IDC_listGroup.addItem(item)
finally:
QApplication.restoreOverrideCursor()
def close_dlg(self):
QDialog.reject(self)
def show_disclaimer(self):
self.dlg_disclaimer = CKANBrowserDialogDisclaimer(self.settings)
self.dlg_disclaimer.show()
def searchtextchanged(self, search_txt):
self.search_txt = search_txt
def suchen(self):
self.current_page = 1
self.current_group = None
self.__search_package()
def list_all_clicked(self):
self.current_page = 1
self.current_group = None
# don't hint on wildcards, empty text works as well, as CKAN uses *:* as
# default when ?q= has not text
# self.IDC_lineSearch.setText('*:*')
#.........这里部分代码省略.........
示例3: CKANBrowserDialogSettings
# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import resolve [as 别名]
class CKANBrowserDialogSettings(QtGui.QDialog, FORM_CLASS):
def __init__(self, settings, iface, parent=None):
"""Constructor."""
super(CKANBrowserDialogSettings, self).__init__(parent)
# Set up the user interface from Designer.
# After setupUI you can access any designer object by doing
# self.<objectname>, and you can use autoconnect slots - see
# http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
# #widgets-and-dialogs-with-auto-connect
self.setupUi(self)
self.iface = iface
self.main_win = parent
self.settings = settings
self.util = Util(self.settings, self.main_win)
self.IDC_leCacheDir.setText(self.settings.cache_dir)
self.IDC_leCkanApi.setText(self.settings.ckan_url)
if QgsAuthConfigSelect is None:
self.IDC_leAuthCfg.hide()
self.IDC_bAuthCfgClear.hide()
self.IDC_bAuthCfgEdit.hide()
self.IDC_lblAuthCfg.hide()
self.IDC_cbAuthPropagate.hide()
else:
if self.settings.authcfg:
self.IDC_leAuthCfg.setText(self.settings.authcfg)
self.IDC_cbAuthPropagate.setChecked(self.settings.auth_propagate)
else:
self.IDC_cbAuthPropagate.setChecked(False)
self.cc = CkanConnector(self.settings, self.util)
self.pre_ckan_apis = None
self.fill_combobox();
def fill_combobox(self):
""" Fill Combobox with predefined CKAN API Urls """
try:
json_path = self.util.resolve(u'CKAN_APIs.json')
with open(json_path) as json_file:
self.pre_ckan_apis = json.load(json_file, object_pairs_hook=OrderedDict)
for key in self.pre_ckan_apis.keys():
self.IDC_cbPreCkanApi.addItem(key)
value = self.pre_ckan_apis.itervalues().next()
self.IDC_lblPreCkan.setText(value)
except IOError as err:
self.util.dlg_warning(self.util.tr(u"py_dlg_set_warn_urls_not_load").format(err))
def select_cache_dir(self):
cache_dir = QFileDialog.getExistingDirectory(
self.main_win,
self.settings.DLG_CAPTION,
self.settings.cache_dir,
QFileDialog.ShowDirsOnly | QFileDialog.DontResolveSymlinks
)
if '' == cache_dir:
self.util.msg_log('no cachedir selected')
else:
self.IDC_leCacheDir.setText(cache_dir)
def test_ckan_url(self):
""" Test if URL in LineEdit is a valid CKAN API URL """
api_url = self.IDC_leCkanApi.text()
self.util.msg_log('URL: {0}'.format(api_url))
QApplication.setOverrideCursor(Qt.WaitCursor)
ok, result = self.cc.test_groups(api_url)
QApplication.restoreOverrideCursor()
if ok is False:
self.util.dlg_warning(result)
return
else:
self.util.dlg_information(self.util.tr(u'py_dlg_set_info_conn_succs'))
# for entry in result:
# self.util.msg_log('Item: {0}'.format(entry))
def pre_ckan_api(self):
"""select CKAN API from predefined file"""
try:
key = self.IDC_cbPreCkanApi.currentText()
value = self.pre_ckan_apis[key]
self.IDC_lblPreCkan.setText(value)
except TypeError as err:
self.util.msg_log('Error: No items in Preselected-Combo-Box: {0}'.format(err))
pass
def choose_pre_api(self):
value = self.IDC_lblPreCkan.text()
self.IDC_leCkanApi.setText(value)
def cancel(self):
#.........这里部分代码省略.........