def loadAddress(self, address_id): #rint'loadAddress' sql = "SELECT postcode \ FROM addresses \ WHERE id = %d" % address_id #rintsql postcode = fetch.getDig(sql) #if postcode: self.num_ctrl_postcode.SetValue(str(postcode)) sql = "SELECT id, itemName \ FROM addressItems \ WHERE itemType = 'kecamatan' \ AND postcode = %d " % postcode dataSet = fetch.getAllCol(sql) if len(dataSet)!=1: # as it should #rint' what to do ?' return kecamatanID = dataSet[0][0] loadCmb.restore(self.combo_kecamatan, kecamatanID) selectedKabupatenID = fetch.cmbID(self.combo_kabupaten) selectedProvinceID = fetch.cmbID(self.combo_province) # step 1: working down ------------------------------- #kecamatan = # do for kabupaten -------------------------------- kabupatenList = fetch.kabupatenForKecamatanID(kecamatanID) if selectedKabupatenID in self.idList(kabupatenList): return kabupatenID = self.setGen(selectedKabupatenID, kabupatenList, self.combo_kabupaten) provinceID = self.provincesForKabupaten(kabupatenID, selectedKabupatenID) self.countriesForProvince(provinceID, selectedProvinceID) return # step 2 - work up kelurahanList = fetch.kelurahanForKecamatanID(kecamatanID) #rint 'upFillKel kelurahanList', kelurahanList self.upFillKel(kelurahanList)
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()