def buatAdmin(self, obj=None): role = obj.namaRole.text() data = role print(data) model = mUser.mUser() res = model.insertUserData('setup_role',data) msg = QMessageBox() if(res): msg.about(obj, "Success", "Berhasil Menginput Data") else: msg.about(obj, "Fail", "Gagal Menginput Data") print(res) ui = dashboard.dashboardUI(obj) obj.hide() ui.show()
def simpanData(self, obj): model = mUser.mUser() nomor = obj.nomorRegis.text() nama = obj.namaPemilik.text() masa = obj.masaBerlaku.text() data = ['', nomor, nama, masa] res = model.insertStnkData(data) msg = QMessageBox() if (res): msg.about(obj, "Success", "Berhasil Menginput Data") else: msg.about(obj, "Fail", "Gagal Menginput Data") #print(res) ui = dashboard.dashboardUI(obj) obj.hide() ui.show()
def insert(self,obj): model= mUser.mUser() index = obj.combo.currentIndex() role = obj.combo.itemData(index) user = obj.namaPengguna.text() nama = obj.namaLengkap.text() sandi = obj.kataSandi.text() data = ['',role,user,sandi,nama,1,'2020-04-03'] res = model.insertAdminData('setup_admin',data) msg = QMessageBox() if(res): msg.about(obj, "Success", "Berhasil Menginput Data") else: msg.about(obj, "Fail", "Gagal Menginput Data") print(res) ui = dashboard.dashboardUI(obj) obj.hide() ui.show()
def getLogin(self, obj): """ params: obj = object of main view (login view) """ user = obj.userName.text() passwd = obj.userPassword.text() where = """ WHERE nama_pengguna = '%s' AND kata_sandi = '%s' """ % (user, passwd) data = self.model.getData("setup_admin", where) msg = QtWidgets.QMessageBox() if len(data) > 0: """ ada dua cara untuk memunculkan dan menghilangkan gui 1. menggunakan setVisible: dengan memasukkan parameter a. False untuk menghilangkan UI b. True untuk menampilkan UI contoh: dash = dashboardUI(obj) obj.setVisible(False) dash.setVisible(True) 2. menggunakan show() dan hide(): cara simple a. show() untuk menampilkan ui b. hide() untuk menyembunyikan ui contoh: ada di codenya! """ idadmin = data['id_admin'][0] nama = data['nama_pengguna'][0] tgl = datetime.date.today().strftime("%Y-%m-%d") isinya = ['', str(idadmin), str(nama), tgl] self.model.insertLogData('log_user', isinya) dash = dashboardUI(obj) obj.setVisible(False) dash.setVisible(True) dash.retrieve(obj) else: msg.about(obj, "Gagal", "Username atau password tidak sesuai!")
def cancel(self,obj): ui = dashboard.dashboardUI(obj) obj.hide() ui.show()
def getBack(self, obj): ui = dashboard.dashboardUI(obj) obj.hide() ui.show()
def cancel(self): self.uinya.hide() self.hide() ui = dashboard.dashboardUI(self) ui.show()
def gotodash(self, obj): dash = dashboard.dashboardUI(obj) obj.hide() dash.show()