本文整理汇总了Python中config.version方法的典型用法代码示例。如果您正苦于以下问题:Python config.version方法的具体用法?Python config.version怎么用?Python config.version使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类config
的用法示例。
在下文中一共展示了config.version方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpClass
# 需要导入模块: import config [as 别名]
# 或者: from config import version [as 别名]
def setUpClass(cls):
"Initialise parts of wxGlade before individual tests starts"
# set icon path back to the default default
#config.icons_path = 'icons'
# initialise wxGlade preferences and set some useful values
common.init_preferences()
config.preferences.autosave = False
config.preferences.write_timestamp = False
config.preferences.show_progress = False
#config.version = '"faked test version"'
# make e.g. the preview raise Exceptions
config.testing = True
# Determinate case and output directory
cls.caseDirectory = os.path.join( os.path.dirname(__file__), cls.caseDirectory )
cls.outDirectory = os.path.join( os.path.dirname(__file__), cls.outDirectory )
if not os.path.exists(cls.outDirectory): os.mkdir(cls.outDirectory)
# disable bug dialogs
sys._called_from_test = True
示例2: quote_str
# 需要导入模块: import config [as 别名]
# 或者: from config import version [as 别名]
def quote_str(self, s):
"""Returns a quoted / escaped version of 's', suitable to insert in a source file as a string object.
Takes care also of gettext support.
Escaped are: quotations marks, backslash, characters with special meaning
Please use quote_path() to quote / escape filenames or paths.
Please check the test case tests.test_codegen.TestCodeGen.test_quote_str() for additional infos.
The language specific implementations are in _quote_str()."""
if not s:
return self.tmpl_empty_string
# no longer with direct generation:
## this is called from the Codewriter which is fed with XML
## here newlines are escaped already as '\n' and '\n' two-character sequences as '\\n'
## so we start by unescaping these
#s = np.TextProperty._unescape(s)
# then escape as required
s = s.replace("\\", "\\\\").replace("\n", "\\n").replace("\t", "\\t").replace('"', '\\"')
return self._quote_str(s)
示例3: update_data
# 需要导入模块: import config [as 别名]
# 或者: from config import version [as 别名]
def update_data(self,exe_list,name_en,name_zh):
host = config.server
port = config.port# 设置端口号
try:
s.connect((host,port))
#print(s.recv(1024))
#print(self.de_msg(self.rec()))
print('服务器连接成功')
except:
print('服务器连接失败')
pass
temp = '#{},{},0,0,1,0,1,0,By-ip_crawl_tool\n'.format(name_en,name_zh)
while True:
time.sleep(1)
f = open("{}.rules".format(str(exe_list)), 'r',encoding='utf-8')
f_temp = f.read()
if f_temp != temp:#判断和上次传送结果是否重复,降低服务器压力
temp = f_temp
msg = {'rules':f_temp,'process':exe_list,'version':config.version}#加入进程名和版本号
msg = self.en_msg(str(msg))
s.send(msg)
f.close()
continue
s.close()
示例4: main
# 需要导入模块: import config [as 别名]
# 或者: from config import version [as 别名]
def main():
#test()
global udp_point
print('ip_crawl_tool'+config.version)
print('3.0版增加上传规则至服务器进行共享,如不想进行规则上传,请使用2.0版')
print('快速版规则请访问 '+config.web_url)
a = input('请输入游戏进程名(可启动游戏后在任务管理器 进程 中查询)\n如果有多个进程请使用英文逗号分隔开:')
udp_point = input('是否抓取udp协议ip,默认不抓取。\n抓取udp协议ip需使用管理员权限运行,且需要开启windows防火墙,请确保使用管理员权限运行本程序和开启了防火请。\n如需抓取udp协议请输入1:')
exe_list = a.split(',')
print('将检测以下程序')
for exe in exe_list:
print(exe)
print('请核对名称是否正确,如不正确请重新启动输入')
run(exe_list)
示例5: trade
# 需要导入模块: import config [as 别名]
# 或者: from config import version [as 别名]
def trade(order_id, amount, order_time):
''' 交易接口
参数
order_id - 交易ID
amount - 交易实际金额
order_time - 交易时间,datetime类型
返回
成功 - 返回结果字典
失败 - 返回None
'''
order_timeout = datetime.datetime.now() + datetime.timedelta(minutes=5)
req = {
'version': config.version,
'charset': config.charset,
'transType': '01',
'merId': config.mer_id,
'backEndUrl': config.mer_backend_url,
'orderTime': datetime.datetime.strftime(order_time, "%Y%m%d%H%M%S"),
'orderTimeout': datetime.datetime.strftime(order_timeout, "%Y%m%d%H%M%S"),
'orderNumber': str(order_id),
# 要求金额字段为 包含角和分、没有小数点的字符串
'orderAmount': str(amount * 100),
}
r = requests.post(config.trade_url, build_req(req))
if r.status_code == 200:
return parse_response(r.text)
else:
return None
示例6: query
# 需要导入模块: import config [as 别名]
# 或者: from config import version [as 别名]
def query(order_id, order_time):
''' 查询接口
参数
order_id - 交易ID
order_time - 交易时间,datetime类型
返回
成功 - 返回结果字典
失败 - 返回None
'''
req = {
'version': config.version,
'charset': config.charset,
'transType': '01',
'merId': config.mer_id,
'backEndUrl': config.mer_backend_url,
'orderTime': datetime.datetime.strftime(datetime.datetime.now(), "%Y%m%d%H%M%S"),
'orderNumber': str(order_id),
}
r = requests.post(config.query_url, build_req(req))
if r.status_code == 200:
return parse_response(r.text)
else:
return None
示例7: _help_cmd
# 需要导入模块: import config [as 别名]
# 或者: from config import version [as 别名]
def _help_cmd(self, bot, update):
self._log_user('_help_cmd', update)
self._add_fsm_and_user(update)
message = ("/start - starts the chat\n"
"/text - shows current text to discuss\n"
"/help - shows this message\n"
"/reset - reset the bot\n"
"/stop - stop the bot\n"
"/evaluation_start - start the evaluation mode \n"
"/evaluation_end - end the evaluation mode and save eval data \n"
"\n"
"Version: {}".format(version))
update.message.reply_text(message)
示例8: init_stage1
# 需要导入模块: import config [as 别名]
# 或者: from config import version [as 别名]
def init_stage1(options):
"""Initialise paths for wxGlade (first stage)
Initialisation is split because the test suite doesn't work with proper initialised paths."""
config.version = config.get_version()
common.init_paths(options)
# initialise own logging extensions
log.init(filename=config.log_file, encoding='utf-8', level='INFO')
atexit.register(log.deinit)
# print versions
logging.info( _('Starting wxGlade version "%s" on Python %s'), config.version, config.py_version )
# print used paths
logging.info(_('Base directory: %s'), config.wxglade_path)
logging.info(_('Documentation directory: %s'), config.docs_path)
logging.info(_('Icons directory: %s'), config.icons_path)
logging.info(_('Build-in widgets directory: %s'), config.widgets_path)
logging.info(_('Template directory: %s'), config.templates_path)
logging.info(_('Credits file: %s'), config.credits_file)
logging.info(_('License file: %s'), config.license_file)
logging.info(_('Manual file: %s'), config.manual_file)
logging.info(_('Tutorial file: %s'), config.tutorial_file)
logging.info(_('Home directory: %s'), config.home_path)
logging.info(_('Application data directory: %s'), config.appdata_path)
logging.info(_('Configuration file: %s'), config.rc_file)
logging.info(_('History file: %s'), config.history_file)
logging.info(_('Log file: %s'), config.log_file)
# adapt application search path
sys.path.insert(0, config.wxglade_path)
sys.path.insert(1, config.widgets_path)
示例9: init_stage2
# 需要导入模块: import config [as 别名]
# 或者: from config import version [as 别名]
def init_stage2(use_gui):
"""Initialise the remaining (non-path) parts of wxGlade (second stage)
use_gui: Starting wxGlade GUI"""
config.use_gui = use_gui
if use_gui:
# import proper wx-module using wxversion, which is only available in Classic
if compat.IS_CLASSIC:
if not hasattr(sys, "frozen") and 'wx' not in sys.modules:
try:
import wxversion
wxversion.ensureMinimal('2.8')
except ImportError:
msg = _('Please install missing Python module "wxversion".')
logging.error(msg)
sys.exit(msg)
try:
import wx
except ImportError:
msg = _('Please install missing Python module "wxPython".')
logging.error(msg)
sys.exit(msg)
# store current version and platform ('not_set' is default)
config.platform = wx.Platform
config.wx_version = wx.__version__
if sys.platform=="win32":
# register ".wxg" extension
try:
import msw
msw.register_extensions(["wxg"], "wxGlade")
except ImportError:
pass
# codewrites, widgets and sizers are loaded in class main.wxGladeFrame
else:
# use_gui has to be set before importing config
common.init_preferences()
common.init_codegen()
示例10: create_widget
# 需要导入模块: import config [as 别名]
# 或者: from config import version [as 别名]
def create_widget(self):
self.widget = wx.TreeCtrl(self.parent_window.widget, self.id, style=self.style) # wx.TR_HAS_BUTTONS|wx.BORDER_SUNKEN)
# add a couple of items just for a better appearance
root = self.widget.AddRoot(_(' Tree Control:'))
self._item_with_name = self.widget.AppendItem(root, ' ' + self.name)
self.widget.AppendItem(self._item_with_name, _(' on wxGlade version %s') % config.version )
self.widget.Expand(root)
self.widget.Expand(self._item_with_name)
示例11: __init__
# 需要导入模块: import config [as 别名]
# 或者: from config import version [as 别名]
def __init__(self, parent=None):
wx.Dialog.__init__(self, parent, -1, _('About wxGlade'))
html = wx.html.HtmlWindow(self, -1, size=(480, 250))
html.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLinkClicked)
# it's recommended at least for GTK2 based wxPython
if "gtk2" in wx.PlatformInfo:
html.SetStandardFonts()
bgcolor = misc.color_to_string(self.GetBackgroundColour())
icon_path = os.path.join(config.icons_path, 'wxglade_small.png')
html.SetPage( self.text % (bgcolor, icon_path, config.version, config.py_version, config.wx_version) )
ir = html.GetInternalRepresentation()
ir.SetIndent(0, wx.html.HTML_INDENT_ALL)
html.SetSize((ir.GetWidth(), ir.GetHeight()))
szr = wx.BoxSizer(wx.VERTICAL)
szr.Add(html, 0, wx.TOP|wx.ALIGN_CENTER, 10)
szr.Add(wx.StaticLine(self, -1), 0, wx.LEFT|wx.RIGHT|wx.EXPAND, 20)
szr2 = wx.BoxSizer(wx.HORIZONTAL)
btn = wx.Button(self, wx.ID_OK, _("OK"))
btn.SetDefault()
szr2.Add(btn)
if wx.Platform == '__WXGTK__':
extra_border = 5 # border around a default button
else:
extra_border = 0
szr.Add(szr2, 0, wx.ALL|wx.ALIGN_RIGHT, 20 + extra_border)
self.SetAutoLayout(True)
self.SetSizer(szr)
szr.Fit(self)
self.Layout()
if parent: self.CenterOnParent()
else: self.CenterOnScreen()
示例12: _get_object_builder
# 需要导入模块: import config [as 别名]
# 或者: from config import version [as 别名]
def _get_object_builder(self, parent_klass, obj):
"Perform some checks and return the code builder"
# Check for widget builder object
try:
builder = self.obj_builders[obj.WX_CLASS]
except KeyError:
# no code generator found: write a comment about it
name = getattr(obj, "name", "None")
name = self._format_name(name)
msg = _('Code for instance "%s" of "%s" not generated: no suitable writer found') % (name, obj.WX_CLASS )
self._source_warning(parent_klass, msg, obj)
self.warning(msg)
return None
# check for supported versions
if hasattr(builder, 'is_widget_supported'):
is_supported = builder.is_widget_supported(*self.for_version)
else:
is_supported = True
if not is_supported:
supported_versions = [misc.format_supported_by(version) for version in builder.config['supported_by']]
msg = _('Code for instance "%(name)s" of "%(klass)s" was\n'
'not created, because the widget is not available for wx version %(requested_version)s.\n'
'It is available for wx versions %(supported_versions)s only.') % {
'name': self._format_name(obj.name), 'klass': obj.klass,
'requested_version': str(misc.format_for_version(self.for_version)),
'supported_versions': ', '.join(supported_versions) }
self._source_warning(parent_klass, msg, obj)
self.warning(msg)
return None
return builder
示例13: create_generated_by
# 需要导入模块: import config [as 别名]
# 或者: from config import version [as 别名]
def create_generated_by(self):
"Create I{generated by wxGlade} string without leading comment characters and without tailing new lines"
generated_from = ''
if config.preferences.write_generated_from and common.app_tree and common.root.filename:
generated_from = ' from "%s"' % common.root.filename
if config.preferences.write_timestamp:
msg = 'generated by wxGlade %s on %s%s' % ( config.version, time.asctime(), generated_from )
else:
msg = 'generated by wxGlade%s' % generated_from
return msg
示例14: write
# 需要导入模块: import config [as 别名]
# 或者: from config import version [as 别名]
def write(self, output, tabs=0):
"""Writes the xml equivalent of this tree to the given output file.
This function writes unicode to the outfile."""
# XXX move this to application.Application
timestring = time.asctime() if not config.testing else 'XXX XXX NN NN:NN:NN NNNN'
output.append( u'<?xml version="1.0"?>\n'
u'<!-- generated by wxGlade %s on %s -->\n\n' % (config.version, timestring) )
attrs = ["name","class","language","top_window","encoding","use_gettext", "overwrite", "mark_blocks",
"for_version","is_template","indent_amount"]
props = [self.properties[attr] for attr in attrs]
attrs = dict( (attr,prop.get_string_value()) for attr,prop in zip(attrs,props) if not prop.deactivated )
top_window_p = self.properties["top_window"]
if top_window_p.deactivated and top_window_p.value:
attrs["top_window"] = top_window_p.value
attrs["option"] = self.properties["multiple_files"].get_string_value()
attrs["indent_symbol"] = self.properties["indent_mode"].get_string_value()
attrs["path"] = self.properties["output_path"].get_string_value()
attrs['use_new_namespace'] = 1
# add a . to the file extensions
attrs["source_extension"] = '.' + self.properties["source_extension"].get_string_value()
attrs["header_extension"] = '.' + self.properties["header_extension"].get_string_value()
inner_xml = []
if self.is_template and getattr(self, 'template_data', None):
self.template_data.write(inner_xml, tabs+1)
for c in self.children:
c.write(inner_xml, tabs+1)
output.extend( common.format_xml_tag( u'application', inner_xml, is_xml=True, **attrs ) )
示例15: set_for_version
# 需要导入模块: import config [as 别名]
# 或者: from config import version [as 别名]
def set_for_version(self, value):
self.for_version = self.for_version_prop.get_string_value()
if self.for_version.startswith('3.'):
## disable lisp for wx > 2.8
if self.codewriters_prop.get_string_value() == 'lisp':
misc.warning_message( _('Generating Lisp code for wxWidgets version %s is not supported.\n'
'Set version to "2.8" instead.') % self.for_version )
self.for_version_prop.set_str_value('2.8')
self.set_for_version('2.8')
return
self.codewriters_prop.enable_item('lisp', False)
else:
# enable lisp again
self.codewriters_prop.enable_item('lisp', True)