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 ) |