class ChooseDialog(QtGui.QDialog): def __init__(self, parent=None, mw = None): super(ChooseDialog, self).__init__(parent) self.ui = Ui_dialog_choose_files() self.ui.setupUi(self) self.mw = mw if mw is None: raise Exception("Ten dialog potrzebuje referencji do glownego okna!") self.ui.comboBox_first_file.addItems(self.mw.media_files_strings) self.ui.comboBox_last_file.addItems(self.mw.media_files_strings) self.ui.comboBox_last_file.setCurrentIndex(self.mw.last_file) self.set_event_name() self.ui.comboBox_first_file.currentIndexChanged.connect(self.set_first) self.ui.comboBox_last_file.currentIndexChanged.connect(self.set_last) self.ui.lineEdit.textChanged.connect(self.set_event_name) self.ui.pushButton_choosen.clicked.connect(self.close) def set_first(self): self.mw.first_file = self.ui.comboBox_first_file.currentIndex() self.set_event_name() def set_last(self): self.mw.last_file = self.ui.comboBox_last_file.currentIndex() def set_event_name(self): e = self.ui.lineEdit.text() date = self.mw.media_files[self.mw.first_file].date e = time.strftime("%Y-%m", date) + " " + e self.mw.event_name = e self.mw.path_dirname = os.path.join(self.mw.path_destination_photos, e) self.ui.label_dst_catalog.setText(self.mw.path_dirname)
def __init__(self, parent=None, mw = None): super(ChooseDialog, self).__init__(parent) self.ui = Ui_dialog_choose_files() self.ui.setupUi(self) self.mw = mw if mw is None: raise Exception("Ten dialog potrzebuje referencji do glownego okna!") self.ui.comboBox_first_file.addItems(self.mw.media_files_strings) self.ui.comboBox_last_file.addItems(self.mw.media_files_strings) self.ui.comboBox_last_file.setCurrentIndex(self.mw.last_file) self.set_event_name() self.ui.comboBox_first_file.currentIndexChanged.connect(self.set_first) self.ui.comboBox_last_file.currentIndexChanged.connect(self.set_last) self.ui.lineEdit.textChanged.connect(self.set_event_name) self.ui.pushButton_choosen.clicked.connect(self.close)