当前位置: 首页>>代码示例>>Python>>正文


Python Config.set方法代码示例

本文整理汇总了Python中config.config.Config.set方法的典型用法代码示例。如果您正苦于以下问题:Python Config.set方法的具体用法?Python Config.set怎么用?Python Config.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在config.config.Config的用法示例。


在下文中一共展示了Config.set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: StartpageWindow

# 需要导入模块: from config.config import Config [as 别名]
# 或者: from config.config.Config import set [as 别名]

#.........这里部分代码省略.........
    def createToolBar(self):
        """创建工具栏

        """
        toolBar = self.CreateToolBar()
        for each in self.toolBarData():
            self.createSimpleTool(toolBar, *each)
        toolBar.Realize()

    def createSimpleTool(self, toolbar, label, filename, help, handler):
        """创建一个工具按钮  --从创建工具栏函数中抽象出来的函数

        """
        if not label:
            toolbar.AddSeparator()
            return
        bmp = wx.Image(filename, wx.BITMAP_TYPE_BMP).ConvertToBitmap()
        tool = toolbar.AddSimpleTool(-1, bmp, label, help)
        self.Bind(wx.EVT_MENU, handler, tool)

    def createMainWindow(self):
        """创建主显示窗口

        """
        pass

    # 显示每日提示
    def ShowTips(self):
        """Shows the tips window on startup; returns False if the option to
        turn off tips is checked.

        """
        # constructs the tip (wx.ShowTip), which returns whether or not the
        # user checked the 'show tips' box
        if wx.ShowTip(None, self.tips, True):
            btmp = 1
            print 1
        else:
            btmp = 0
            print 0
        self.config.set("other", "showtips", btmp)
        return self.config.get("other", "showtips")

    # ----------------------主框架的事件响应函数------------------------#
    def OnCreateStaff(self, event):
        pass

    def OnModifyStaff(self, event):
        pass

    def OnDisplayStaff(self, event):
        pass

    def OnFilterStaff(self, event):
        pass

    def OnMailSalary(self, event):
        pass

    def OnOpenExpAccHtml(self, event):
        pass

    def OnSearchAddr(self, event):
        pass

    def OnManual(self, event):
        pass

    def OnCopyRight(self, event):
        pass

    def OnAuthor(self, event):
        pass

    def OnAbout(self, event):
        pass

    def createStatusBar(self):
        self.statusBar = self.CreateStatusBar()
        self.statusBar.SetFieldsCount(3)
        self.statusBar.SetStatusWidths([-1, -2, -3])

    # Sash位置变动
    def OnSashPosChanged(self, event):
        """Handler for when the splitter sash,
        who divided the `tree` and the `content`, is moved.

        """
        pass

    #        pos = self.splitter.GetSashPosition()
    #        self.config.setValue("sashposition", pos)

    def OnSelChanged(self):
        pass

    # 关闭主框架,清理资源 # TODO:devo
    def OnCloseWindow(self, event):
        self.tbIcon.Destroy()
        self.Destroy()
开发者ID:cmal,项目名称:sc2mafia,代码行数:104,代码来源:window.py

示例2: len

# 需要导入模块: from config.config import Config [as 别名]
# 或者: from config.config.Config import set [as 别名]
import time
import datetime
import base64
from config.config import Config

if __name__ == "__main__":
    if len(sys.argv) != 3:
        print '''Usage: %s option value

OPTIONS:
ip:              ip address (need restart)
port:            port number (need restart)
''' % sys.argv[0]
        sys.exit()
    
    data_path = os.path.join(os.path.dirname(__file__), 'data')
    config = Config(data_path + '/config.ini')

    option, value = sys.argv[1:]
    if option == 'ip':
        if value != '*' and not is_valid_ip(value):
            print 'Error: %s is not a valid IP address' % value
            sys.exit(-1)
        config.set('server', 'ip', value)
    elif option == 'port':
        port = int(value)
        if not port > 0 and port < 65535:
            print 'Error: port number should between 0 and 65535'
            sys.exit(-1)
        config.set('server', 'port', value)
开发者ID:BillWang139967,项目名称:PlantingPeony,代码行数:32,代码来源:config.py


注:本文中的config.config.Config.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。