Esempio n. 1
0
class TZprompt(QDialog):
    def __init__(self, parent=None):
        super(TZprompt, self).__init__(parent)

        #self.idDates = QCheckBox("Import ID and created/modified dates")

        promptLabel = QLabel("Time Zone in which the Tellico data was entered:")

        self.zoneName = QComboBox(self)
        current = -1
        self.suppliedTZ = 'America/Chicago'
        for i, zone in enumerate (pytz.common_timezones):
            self.zoneName.addItem(zone, i)
            if self.suppliedTZ == zone:
                current = i
        self.zoneName.setCurrentIndex(current)

        self.submitButton = QPushButton("Submit")
        self.submitButton.isDefault()


        buttonLayout1 = QVBoxLayout()
        #buttonLayout1.addWidget(self.idDates)
        buttonLayout1.addWidget(promptLabel)
        buttonLayout1.addWidget(self.zoneName)
        buttonLayout1.addWidget(self.submitButton)

        self.submitButton.clicked.connect(self.TZsubmitted)

        mainLayout = QGridLayout()
        mainLayout.addLayout(buttonLayout1, 0, 1)

        self.setLayout(mainLayout)
        self.setWindowTitle("Time Zone")

    def TZsubmitted(self):
        self.suppliedTZ = self.zoneName.currentText()
        QDialog.accept(self)

    @staticmethod
    def getTZ(parent = None):
        TZdialog = TZprompt(parent)
        result = TZdialog.exec_()

        if result == QDialog.Accepted:
            return TZdialog.suppliedTZ

        return 'UTC'