def save(settings): for w in qApp.allWidgets(): mo = w.metaObject() if w.objectName() in ['username_text_box', 'password_text_box', 'forget_password']: for i in range(mo.propertyCount()): name = mo.property(i).name() settings.setValue("{}/{}".format(w.objectName(), name), w.property(name))
def save(settings): for w in qApp.allWidgets(): mo = w.metaObject() if w.objectName() != "": for i in range(mo.propertyCount()): name = mo.property(i).name() settings.setValue("{}/{}".format(w.objectName(), name), w.property(name))
def guirestore(self, settings): for w in qApp.allWidgets(): mo = w.metaObject() if w.objectName() != "": for i in range(mo.propertyCount()): name = mo.property(i).name() val = self.settings.value("{}/{}".format(w.objectName(), name), w.property(name)) w.setProperty(name, val)
def guisave(self): #settings = QSettings("gui.ini", QSettings.IniFormat) for w in qApp.allWidgets(): mo = w.metaObject() if w.objectName() != "": for i in range(mo.propertyCount()): name = mo.property(i).name() self.settings.setValue("{}/{}".format(w.objectName(), name), w.property(name))
def restore(settings): finfo = QFileInfo(settings.fileName()) if finfo.exists() and finfo.isFile(): for w in qApp.allWidgets(): mo = w.metaObject() if w.objectName() in ['username_text_box', 'password_text_box', 'forget_password']: for i in range(mo.propertyCount()): name = mo.property(i).name() val = settings.value("{}/{}".format(w.objectName(), name), w.property(name)) w.setProperty(name, val)
def loadLang(self, index=0, lang=None): try: qApp.removeTranslator(self.translator) except: pass if not lang: if self.ui.comboBox.findData(index) < 0: lang = self.ui.comboBox.itemData(index) ctx.lang = lang qmFile = os.path.join(str(self._path), "{lang}.qm".format(lang=lang)) if not os.path.exists(qmFile): return self.translator = QTranslator() self.translator.load(qmFile) qApp.installTranslator(self.translator) self.retranslateUi() ctx.mainScreen.retranslateUi() try: ctx.mainScreen.stackMove(0) except: pass try: hata_sayisi = 0 for widget in qApp.allWidgets(): try: widget.ui.retranslateUi(widget) except: pass except: print("hata ")