def displayData(self, address_id=0): self.numCtrlActive = False self.address_id = address_id self.loadAllCombos() self.num_ctrl_postcode.SetValue(0) sql = "SELECT poscode FROM addresses WHERE address_id = %d" % address_id postcode = fetch.getStr(sql) if postcode: sql = "SELECT * FROM postcodes WHERE postcode =%d" % postcode dataSet = fetch.getOneDict(sql) self.num_ctrl_postcode.SetValue(dataSet["postcode"]) kelurahan, kecamatan, kabupaten, province = ( dataSet("kelurahan"), dataSet("kecamatan"), dataSet("kabupaten"), dataSet("province"), ) if kelurahan: loadCmb.restore_str(self.combo_kabupaten, kabupaten) self.loadCmbsUnderKab(kabupaten) elif kecamatan: loadCmb.restore_str(self.combo_kecamatan, kecamatan) self.loadCmbsUnderKec(kecamatan) elif kelurahan: loadCmb.restore_str(self.combo_kelurahan, kelurahan) self.loadCmbsUnderKal(kelurahan)
def loadCmbsUnderKel(self, kelurahan): #rint'loadCmbsUnderKel' sql = "SELECT kecamatan FROM postcodes \ WHERE kelurahan = '%s'" % kelurahan kecamatan = fetch.getStr(sql) loadCmb.restore_str(self.combo_box_kec, kecamatan) sql = "SELECT kabupaten FROM postcodes \ WHERE kelurahan = '%s'" % kelurahan kabupaten = fetch.getStr(sql) loadCmb.restore_str(self.combo_box_kab, kabupaten) sql = "SELECT postcode FROM postcodes \ WHERE kelurahan = '%s'" % kelurahan postcode = fetch.getDig(sql) self.num_ctrl_postcode.Freeze() self.num_ctrl_postcode.SetValue(postcode) self.num_ctrl_postcode.Thaw()
def loadCmbsUnderKec(self, kecamatan): #rint'loadCmbsUnderKec' sql = "SELECT kelurahan FROM postcodes \ WHERE kecamatan = '%s' \ GROUP BY (kelurahan) \ ORDER BY (kelurahan)" % kecamatan self.combo_box_kel.Clear() loadCmb.setItems(self.combo_box_kel, sql) sql = "SELECT kabupaten FROM postcodes \ WHERE kecamatan = '%s'" % kecamatan kabupaten = fetch.getStr(sql) loadCmb.restore_str(self.combo_box_kab, kabupaten)
def batchDivisions(cmb, batch_id): cmb.Clear() cmb.Append('Entire', 0) sql = " SELECT divisions \ FROM batches\ WHERE id = %d" % batch_id divisions = fetch.getStr(sql) if not divisions: cmb.Select(0) return list = row.split(',') index = 0 for set in list: groups = set.split('/') for group in groups: cmb.Append(group, index) index += 1