ProjectDjangoTagsMenu/TimezoneSelectionDialog.py

changeset 12
8bc18ea91897
parent 11
7e3e1ee102c5
child 16
f2d493540f04
equal deleted inserted replaced
11:7e3e1ee102c5 12:8bc18ea91897
238 'Whitehorse', 238 'Whitehorse',
239 'Winnipeg', 239 'Winnipeg',
240 'Yakutat', 240 'Yakutat',
241 'Yellowknife', 241 'Yellowknife',
242 ], 242 ],
243 'Antarctica':[ 243 'Antarctica': [
244 'Casey', 244 'Casey',
245 'Davis', 245 'Davis',
246 'DumontDUrville', 246 'DumontDUrville',
247 'Macquarie', 247 'Macquarie',
248 'Mawson', 248 'Mawson',
251 'Rothera', 251 'Rothera',
252 'South_Pole', 252 'South_Pole',
253 'Syowa', 253 'Syowa',
254 'Vostok', 254 'Vostok',
255 ], 255 ],
256 'Arctic':[ 256 'Arctic': [
257 'Longyearbyen', 257 'Longyearbyen',
258 ], 258 ],
259 'Asia': [ 259 'Asia': [
260 'Aden', 260 'Aden',
261 'Almaty', 261 'Almaty',
524 def __updateOK(self): 524 def __updateOK(self):
525 """ 525 """
526 Private method to update the OK button. 526 Private method to update the OK button.
527 """ 527 """
528 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( 528 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
529 bool(self.regionCombo.currentText()) and 529 bool(self.regionCombo.currentText()) and
530 len(self.cityList.selectedItems()) == 1 530 len(self.cityList.selectedItems()) == 1
531 ) 531 )
532 532
533 @pyqtSlot(str) 533 @pyqtSlot(str)
534 def on_regionCombo_currentIndexChanged(self, region): 534 def on_regionCombo_currentIndexChanged(self, region):
535 """ 535 """
536 Private slot handling the selection of a time zone region. 536 Private slot handling the selection of a time zone region.
537 537
538 @param region selected region (string) 538 @param region selected region (string)
539 """ 539 """
540 self.cityList.clear() 540 self.cityList.clear()
541 if region in self.Timezones: 541 if region in self.Timezones:
542 self.cityList.addItems(sorted(self.Timezones[region])) 542 self.cityList.addItems(sorted(self.Timezones[region]))
543 543
554 """ 554 """
555 Public method to retrieve the data. 555 Public method to retrieve the data.
556 556
557 @return selected time zone (string) 557 @return selected time zone (string)
558 """ 558 """
559 if (self.regionCombo.currentText() and 559 if (self.regionCombo.currentText() and
560 len(self.cityList.selectedItems()) == 1): 560 len(self.cityList.selectedItems()) == 1):
561 return "{0}/{1}".format( 561 return "{0}/{1}".format(
562 self.regionCombo.currentText(), 562 self.regionCombo.currentText(),
563 self.cityList.selectedItems()[0].text() 563 self.cityList.selectedItems()[0].text()
564 ) 564 )

eric ide

mercurial