當前位置: 首頁>>代碼示例>>Python>>正文


Python config.version方法代碼示例

本文整理匯總了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 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:24,代碼來源:testsupport_new.py

示例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) 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:21,代碼來源:__init__.py

示例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() 
開發者ID:oooldtoy,項目名稱:SSTAP_ip_crawl_tool,代碼行數:28,代碼來源:ip_crawl_tool.py

示例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) 
開發者ID:oooldtoy,項目名稱:SSTAP_ip_crawl_tool,代碼行數:16,代碼來源:ip_crawl_tool.py

示例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 
開發者ID:raully7,項目名稱:unionpay,代碼行數:39,代碼來源:upmp_service.py

示例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 
開發者ID:raully7,項目名稱:unionpay,代碼行數:32,代碼來源:upmp_service.py

示例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) 
開發者ID:sld,項目名稱:convai-bot-1337,代碼行數:17,代碼來源:telegram_main.py

示例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) 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:34,代碼來源:wxglade.py

示例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() 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:42,代碼來源:wxglade.py

示例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) 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:10,代碼來源:tree_ctrl.py

示例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() 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:33,代碼來源:about.py

示例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 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:35,代碼來源:__init__.py

示例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 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:13,代碼來源:__init__.py

示例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 ) ) 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:34,代碼來源:application.py

示例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) 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:17,代碼來源:application.py


注:本文中的config.version方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。