def list_commands(self): comands = mdb_get_table(table.name) liste = ['Umschalten'] for comand in comands: liste.append(comand.get("Name")) liste.remove("Name") return liste
def list_commands(self,gruppe='default'): table = mdb_get_table(constants.sql_tables.szenen.name) liste = {'':''} if gruppe == "default": for szene in table: if szene.get("Gruppe") <>"Intern": if str(szene.get("Beschreibung")) <> "None": liste[szene.get("Name")] = szene.get("Beschreibung") else: liste[szene.get("Name")] = szene.get("Name") elif gruppe == "alle" or gruppe == "": for szene in table: if int(szene.get("Id")) > 19: if str(szene.get("Beschreibung")) <> "None": liste[szene.get("Name")] = szene.get("Beschreibung") else: liste[szene.get("Name")] = szene.get("Name") else: for szene in table: if szene.get("Gruppe") == gruppe: if str(szene.get("Beschreibung")) <> "None": liste[szene.get("Name")] = szene.get("Beschreibung") else: liste[szene.get("Name")] = szene.get("Name") return (liste)
def list_commands(self): comands = mdb_get_table(table.name) liste = ["Pause","Play","Save","Announce_Time","Durchsage",'Ansage',"Return","resume","lauter", "leiser","inc_leiser","inc_lauter","WeckerAnsage", "EingangWohnzi"] for comand in comands: liste.append(comand.get("Name")) #liste.remove("Name") return liste
def get_satellite(name): list = mdb_get_table(constants.sql_tables.satellites.name) simplelist = [] x = None for satellite in list: if satellite.get("Name") == name: x = sputnik(satellite.get("Name"),satellite.get("IP"),satellite.get("PORT"),satellite.get("Type"),satellite.get("USER"),satellite.get("PASS"),satellite.get("command_set")) x.attr = satellite return x
def __init__(self, expand = None, isInputs = True, inputsGroup = None, cmdTable = None): self.p = None self.name = None self.expand = expand self._szn_lst = sorted(szn.list_commands(gruppe="alle")) if isInputs: self.inputs = mdb_get_table(db='cmd_inputs') else: self.inputs = mdb_get_table(db=cmdTable) if inputsGroup == None: self.inputsGroup = '' else: self.inputsGroup = inputsGroup self.eingaenge = [] for inpu in self.inputs: self.eingaenge.append(str(inpu.get('Id'))) self.isInputs = isInputs self.cmdTable = cmdTable self.set_paratree()
def send_direkt(self, to, titel, text): success = True data = {'titel': titel, 'message': text} gcm_users = mdb_get_table(table.name) for user in gcm_users: if user.get('Name') <> None: if (user.get('Name') in to) and (str(setting_r(str('Notify_'+ user.get('Name')))) == "True") and constants.redundancy_.master: response = self.gcm.json_request(registration_ids=[user.get('gcm_regid')], data=data) print response if response <> {}: success = False return success
def list_commands(self,device='alle'): liste = [] list_cmds_of = [] if device == 'alle': list_cmds_of = self.list_devices() else: list_cmds_of.append(device) for sates in list_cmds_of: cmds_table=mdb_read_table_entry(table.name,sates).get('command_set') if self.__check_table_exists__(cmds_table): comands = mdb_get_table(cmds_table) for comand in comands: liste.append(comand.get("Name")) return liste
def dict_commands(self,device='alle'): liste = {'':1,'man':2,'auto':3} itera = 3 list_cmds_of = [] if device == 'alle': list_cmds_of = self.list_devices() else: list_cmds_of.append(device) for sates in list_cmds_of: cmds_table=mdb_read_table_entry(table.name,sates).get('command_set') if self.__check_table_exists__(cmds_table): comands = mdb_get_table(cmds_table) for comand in comands: itera +=1 liste[comand.get("Name")] = itera elif cmds_table == 'server': comands = mdb_read_table_column(constants.sql_tables.szenen.name, 'Name') for comand in comands: itera +=1 liste[comand] = itera return liste
def update(): global inp,t,t2,t3,t4,sz, sets,cmds,seTre, comboBox, comboBox2, comboBox3, szn_lst, xs1_devs, xs1_cmds, hue_devs, hue_cmds, sns_devs, sns_cmds, tvs_devs, tvs_cmds, sat_devs, sat_cmds, cmd_devs szn_lst = sorted(szn.list_commands()) xs1_devs = xs1.list_devices() xs1_cmds = xs1.dict_commands() hue_devs = hue.list_devices() hue_cmds = hue.dict_commands() sns_devs = sn.list_devices() sns_cmds = sn.dict_commands() tvs_devs = tv.list_devices() tvs_cmds = tv.dict_commands() sat_devs = sat.list_devices() sat_cmds = sat.dict_commands() cmd_devs = xs1_devs + hue_devs + sns_devs + tvs_devs + sat_devs sets = mdb_get_table(constants.sql_tables.settings.name) selected(lastSelected) inp=InputsTree(isInputs = True, inputsGroup = str(comboBox5.currentText())) t2.setParameters(inp.p, showTop=False) cmds=InputsTree(isInputs = False, cmdTable = cmd_lsts[0]) t3.setParameters(cmds.p, showTop=False) seTre = SettingsTree() t4.setParameters(seTre.p, showTop=False) comboBox.clear() for szne in szn_lst: comboBox.addItem(szne) comboBox2.clear() for cmdLst in cmd_lsts: comboBox2.addItem(cmdLst) comboBox2.activated[str].connect(slctCmdLst) comboBox3.clear() inpts = sorted(mdb_read_table_column(db="cmd_inputs", column = 'Description')) for inpt in inpts: if str(inpt) <> "": comboBox3.addItem(str(inpt)) inp.p.sigTreeStateChanged.connect(change) sz.p.sigTreeStateChanged.connect(change_sz)
from mysql_con import mdb_get_table, mdb_set_table app = QtGui.QApplication([]) from pyqtgraph.parametertree import Parameter, ParameterTree from cmd_szenen import szenen from cmd_satellites import satelliten szn = szenen() szn_lst = sorted(szn.list_commands('alle')) cmdLsts = ['out_hue','out_Sonos'] sate = satelliten() cmdLsts += sate.listCommandTable('alle') sets = mdb_get_table(constants.sql_tables.settings.name) class SzenenTreeInputs(): def __init__(self, isInputs = True, cmdTable = None): self.p = None self.name = None self.set_paratree() def __return_enum__(self,eingabe): if (type(eingabe) == str): try: if type(eval(eingabe)) == list or type(eval(eingabe)) == dict or type(eval(eingabe)) == tuple: kommandos = eval(eingabe) else: kommandos = [eingabe]