示例#1
0
文件: main.py 项目: arcxxi/genesis
 def order(self, op, name, ptype='program', args=[]):
     if op == 'new':
         SVClient(self.app).set(ptype, name, args)
     elif op == 'del':
         SVClient(self.app).remove(name, restart=True)
     elif op == 'rel':
         SVClient(self.app).restart(name)
示例#2
0
 def handle(self, event, params, cfg, vars=None):
     mgr = SVClient(self.app)
     if params[0] == 'start':
         mgr.start(cfg)
     if params[0] == 'stop':
         mgr.stop(cfg)
     if params[0] == 'restart':
         mgr.restart(cfg)
示例#3
0
 def get_config_dialog(self):
     mgr = SVClient(self.app)
     dlg = self.app.inflate('supervisor:widget-config')
     for s in mgr.status():
         dlg.append('list', UI.SelectOption(
             value=s['name'],
             text=s['name'],
         ))
     return dlg
示例#4
0
    def get_ui(self, cfg, id=None):
        mgr = SVClient(self.app)
        running = False

        for x in mgr.status():
            if x['name'] == cfg and x['status'] == 'RUNNING':
                running = True

        self.title = cfg
        self.icon = '/dl/core/ui/stock/service-' + ('run.png' if running else 'stop.png')

        ui = self.app.inflate('supervisor:widget')
        if running:
            ui.remove('start')
            ui.find('stop').set('id', id+'/stop')
            ui.find('restart').set('id', id+'/restart')
        else:
            ui.remove('stop')
            ui.remove('restart')
            ui.find('start').set('id', id+'/start')
        return ui
示例#5
0
文件: widget.py 项目: tewe/genesis
    def get_ui(self, cfg, id=None):
        mgr = SVClient(self.app)
        running = False

        for x in mgr.list():
            if x['name'] == cfg and x['status'] == 'RUNNING':
                running = True

        self.title = cfg
        self.iconfont = 'gen-' + ('play-2' if running else 'stop')

        ui = self.app.inflate('supervisor:widget')
        if running:
            ui.remove('start')
            ui.find('stop').set('id', id + '/stop')
            ui.find('restart').set('id', id + '/restart')
        else:
            ui.remove('stop')
            ui.remove('restart')
            ui.find('start').set('id', id + '/start')
        return ui
示例#6
0
文件: main.py 项目: arcxxi/genesis
 def on_session_start(self):
     self._client = SVClient(self.app)
     self._tail = None
     self._set = None