Exemplo n.º 1
0
 def saveConfiguration(self):
     size = self.Size
     pos = self.Position
     config = Config()
     config.posX = pos.x
     config.posY = pos.y
     config.sizeX = size.x
     config.sizeY = size.y
Exemplo n.º 2
0
def main():
    logger = logging.getLogger("genicontrol")
    config = Config()
    config.loadConfiguration()
    size = wx.Size(config.sizeX, config.sizeY)
    pos = wx.Point(config.posX, config.posY)
    app = GeniControlApp()
    frame = GBFrame(None, size, pos)

    controller = GUIController(NullModel, frame)

    frame.Show(True)
    app.MainLoop()
    config.saveConfiguration()
Exemplo n.º 3
0
    def __init__(self, parent):
        wx.Dialog.__init__(self, parent, wx.ID_ANY, u"Options")
        config = Config()
        # config.loadConfiguration()

        sizer = wx.BoxSizer(wx.VERTICAL)
        gridsizer = wx.FlexGridSizer(4, 2)
        st = wx.StaticText(self, label="Server IP-address")
        gridsizer.Add(st, 1, wx.ALL | wx.ALIGN_LEFT, 5)
        addr = ipaddrctrl.IpAddrCtrl(self, id=ID_IPADDR)
        gridsizer.Add(addr, 1, wx.ALL | wx.ALIGN_RIGHT, 5)
        st = wx.StaticText(self, label="Subnet-mask")
        gridsizer.Add(st, 1, wx.ALL | wx.ALIGN_LEFT, 5)
        mask = ipaddrctrl.IpAddrCtrl(self, id=ID_SUBNET)
        gridsizer.Add(mask, 1, wx.ALL | wx.ALIGN_RIGHT, 5)
        st = wx.StaticText(self, label="Server-port")
        gridsizer.Add(st, 1, wx.ALL | wx.ALIGN_LEFT, 5)
        port = TextCtrl(self, id=ID_PORT, mask="#####")
        gridsizer.Add(port, 1, wx.ALL | wx.ALIGN_RIGHT, 5)
        sizer.Add(gridsizer, 1, wx.ALL, 5)
        st = wx.StaticText(self, label="Polling interval")
        gridsizer.Add(st, 1, wx.ALL | wx.ALIGN_LEFT, 5)
        poll = TextCtrl(self, id=ID_POLL, mask="#####")
        gridsizer.Add(poll, 1, wx.ALL | wx.ALIGN_RIGHT, 5)
        line = wx.StaticLine(self, style=wx.LI_HORIZONTAL)
        sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
        btnsizer = wx.StdDialogButtonSizer()
        okButton = wx.Button(self, id=wx.ID_OK)
        okButton.SetDefault()
        btnsizer.Add(okButton)
        cancelButton = wx.Button(self, id=wx.ID_CANCEL)
        btnsizer.AddButton(cancelButton)
        btnsizer.Realize()
        sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
        self.SetSizer(sizer)
        sizer.Fit(self)
        config.serverIP = fixIP(config.serverIP)
        addr.SetValue(config.serverIP)
        config.subnetMask = fixIP(config.subnetMask)
        mask.SetValue(config.subnetMask)
        port.SetValue(config.serverPort)
        poll.SetValue(str(config.pollingInterval))

        addr.SetFocus()
        # self.SetValues()
        self.Centre()
        retval = self.ShowModal()
        retval = wx.ID_OK
        if retval == wx.ID_OK:
            config.serverIP = fixIP(addr.GetValue())
            config.subnetMaskP = fixIP(mask.GetValue())
            config.serverPortP = port.GetValue()
            config.pollingInterval = poll.GetValue()
        self.Destroy()