def __init__(self, main, title_font_size, button_size_w, button_size_h, button_font_size, subtitle_font_size):
        super().__init__()

        self.main = main
        self.batcher = Renamer()
        self.progressWindow = ProgressWindow(self.main, 'Zmiana nazwy', self.batcher, 32, 0, 0, 12, 22)

        # deklaracja napisow

        title = QLabel('Zmiena nazwy')

        label_font = title.font()
        label_font.setPointSize(title_font_size)
        label_font.setBold(True)
        title.setFont(label_font)

        self.folder_name_label = QLabel('')
        self.folder_dest_name_label = QLabel('')

        text_before_label = QLabel('Tekst początkowy: ')
        digits_amount_label = QLabel('Ilość cyfr: ')

        label_font.setPointSize(subtitle_font_size)

        # deklaracja przyciskow

        back_but = QPushButton('wstecz')
        choose_but = QPushButton('Wybierz folder...')
        import_but = QPushButton('Import ustawień...')
        export_but = QPushButton('Export ustawień...')
        go_but = QPushButton('GO!')
        renaming_preview = QPushButton('Wygeneruj podgląd')

        go_but.setFixedSize(button_size_w, button_size_h)
        but_font = go_but.font()
        but_font.setPointSize(button_font_size)
        go_but.setFont(but_font)

        # deklaracja editline'ow

        self.text_before_line = QLineEdit()
        self.digits_amount_line = QLineEdit()

        # deklaracja listy mianiturek

        self.miniature_list = QListView()
        self.miniature_list_model = QStandardItemModel()
        self.miniature_list.setModel(self.miniature_list_model)
        self.miniature_list.setMinimumHeight(100)

        # layout

        title_layout = QHBoxLayout()
        title_layout.addWidget(back_but)
        title_layout.addWidget(title)
        title_layout.addStretch()

        choose_folder_layout = QHBoxLayout()
        choose_folder_layout.addWidget(choose_but)
        choose_folder_layout.addWidget(self.folder_name_label)
        choose_folder_layout.addStretch()

        import_layout = QHBoxLayout()
        import_layout.addWidget(import_but)
        import_layout.addStretch()

        export_layout = QHBoxLayout()
        export_layout.addWidget(export_but)
        export_layout.addStretch()

        text_before_layout = QHBoxLayout()
        text_before_layout.addWidget(text_before_label)
        text_before_layout.addWidget(self.text_before_line)
        text_before_layout.addStretch()

        left_layout = QVBoxLayout()
        left_layout.addLayout(import_layout)
        left_layout.addLayout(text_before_layout)

        digits_amount_layout = QHBoxLayout()
        digits_amount_layout.addWidget(digits_amount_label)
        digits_amount_layout.addWidget(self.digits_amount_line)
        digits_amount_layout.addStretch()

        right_layout = QVBoxLayout()
        right_layout.addLayout(export_layout)
        right_layout.addLayout(digits_amount_layout)

        left_right_layout = QHBoxLayout()
        left_right_layout.addLayout(left_layout)
        left_right_layout.addLayout(right_layout)

        preview_layout = QHBoxLayout()
        preview_layout.addStretch()
        preview_layout.addWidget(renaming_preview)
        preview_layout.addStretch()

        go_but_layout = QHBoxLayout()
        go_but_layout.addStretch()
        go_but_layout.addWidget(go_but)
        go_but_layout.addStretch()

        miniature_list_layout = QHBoxLayout()
        miniature_list_layout.addWidget(self.miniature_list)

        main_layout = QVBoxLayout()
        main_layout.addLayout(title_layout)
        main_layout.addWidget(self.main.h_line())
        main_layout.addLayout(choose_folder_layout)
        main_layout.addWidget(self.main.h_line())
        main_layout.addLayout(left_right_layout)
        main_layout.addLayout(preview_layout)
        main_layout.addLayout(miniature_list_layout)
        main_layout.addWidget(self.main.h_line())
        main_layout.addLayout(go_but_layout)

        self.setLayout(main_layout)

        # podpiecia przyciskow

        back_but.clicked.connect(self.back_but_fun)
        choose_but.clicked.connect(self.choose_but_fun)
        renaming_preview.clicked.connect(self.generate_preview)
        import_but.clicked.connect(self.import_settings)
        export_but.clicked.connect(self.export_settings)

        go_but.clicked.connect(self.go_but_fun)
class NameChangeWindow(QWidget):
    def __init__(self, main, title_font_size, button_size_w, button_size_h, button_font_size, subtitle_font_size):
        super().__init__()

        self.main = main
        self.batcher = Renamer()
        self.progressWindow = ProgressWindow(self.main, 'Zmiana nazwy', self.batcher, 32, 0, 0, 12, 22)

        # deklaracja napisow

        title = QLabel('Zmiena nazwy')

        label_font = title.font()
        label_font.setPointSize(title_font_size)
        label_font.setBold(True)
        title.setFont(label_font)

        self.folder_name_label = QLabel('')
        self.folder_dest_name_label = QLabel('')

        text_before_label = QLabel('Tekst początkowy: ')
        digits_amount_label = QLabel('Ilość cyfr: ')

        label_font.setPointSize(subtitle_font_size)

        # deklaracja przyciskow

        back_but = QPushButton('wstecz')
        choose_but = QPushButton('Wybierz folder...')
        import_but = QPushButton('Import ustawień...')
        export_but = QPushButton('Export ustawień...')
        go_but = QPushButton('GO!')
        renaming_preview = QPushButton('Wygeneruj podgląd')

        go_but.setFixedSize(button_size_w, button_size_h)
        but_font = go_but.font()
        but_font.setPointSize(button_font_size)
        go_but.setFont(but_font)

        # deklaracja editline'ow

        self.text_before_line = QLineEdit()
        self.digits_amount_line = QLineEdit()

        # deklaracja listy mianiturek

        self.miniature_list = QListView()
        self.miniature_list_model = QStandardItemModel()
        self.miniature_list.setModel(self.miniature_list_model)
        self.miniature_list.setMinimumHeight(100)

        # layout

        title_layout = QHBoxLayout()
        title_layout.addWidget(back_but)
        title_layout.addWidget(title)
        title_layout.addStretch()

        choose_folder_layout = QHBoxLayout()
        choose_folder_layout.addWidget(choose_but)
        choose_folder_layout.addWidget(self.folder_name_label)
        choose_folder_layout.addStretch()

        import_layout = QHBoxLayout()
        import_layout.addWidget(import_but)
        import_layout.addStretch()

        export_layout = QHBoxLayout()
        export_layout.addWidget(export_but)
        export_layout.addStretch()

        text_before_layout = QHBoxLayout()
        text_before_layout.addWidget(text_before_label)
        text_before_layout.addWidget(self.text_before_line)
        text_before_layout.addStretch()

        left_layout = QVBoxLayout()
        left_layout.addLayout(import_layout)
        left_layout.addLayout(text_before_layout)

        digits_amount_layout = QHBoxLayout()
        digits_amount_layout.addWidget(digits_amount_label)
        digits_amount_layout.addWidget(self.digits_amount_line)
        digits_amount_layout.addStretch()

        right_layout = QVBoxLayout()
        right_layout.addLayout(export_layout)
        right_layout.addLayout(digits_amount_layout)

        left_right_layout = QHBoxLayout()
        left_right_layout.addLayout(left_layout)
        left_right_layout.addLayout(right_layout)

        preview_layout = QHBoxLayout()
        preview_layout.addStretch()
        preview_layout.addWidget(renaming_preview)
        preview_layout.addStretch()

        go_but_layout = QHBoxLayout()
        go_but_layout.addStretch()
        go_but_layout.addWidget(go_but)
        go_but_layout.addStretch()

        miniature_list_layout = QHBoxLayout()
        miniature_list_layout.addWidget(self.miniature_list)

        main_layout = QVBoxLayout()
        main_layout.addLayout(title_layout)
        main_layout.addWidget(self.main.h_line())
        main_layout.addLayout(choose_folder_layout)
        main_layout.addWidget(self.main.h_line())
        main_layout.addLayout(left_right_layout)
        main_layout.addLayout(preview_layout)
        main_layout.addLayout(miniature_list_layout)
        main_layout.addWidget(self.main.h_line())
        main_layout.addLayout(go_but_layout)

        self.setLayout(main_layout)

        # podpiecia przyciskow

        back_but.clicked.connect(self.back_but_fun)
        choose_but.clicked.connect(self.choose_but_fun)
        renaming_preview.clicked.connect(self.generate_preview)
        import_but.clicked.connect(self.import_settings)
        export_but.clicked.connect(self.export_settings)

        go_but.clicked.connect(self.go_but_fun)

    def import_settings(self):
        try:
            prop_path = QFileDialog.getOpenFileName(self, "Wczytaj ustawienia...", self.main.get_home_dir())
            self.batcher.load_prop(prop_path)
            self.text_before_line.setText(str(self.batcher.prop['text']))
            self.digits_amount_line.setText(str(self.batcher.prop['digits']))
        except ValueError as err:
            self.main.statusBar().showMessage(str(err), 3000)
        except FileNotFoundError:
            self.main.statusBar().showMessage("Błędnie wybrany plik", 3000)
        except NameError:
            self.main.statusBar().showMessage("Wczytano nieodpowiedni plik", 3000)

    def export_settings(self):
        try:
            self.batcher.set_prop('text', self.text_before_line.text())
            self.batcher.set_prop('digits', self.digits_amount_line.text())
            prop_path = QFileDialog.getSaveFileName(self, "Zapisz ustawienia...", self.main.get_home_dir())
            self.batcher.save_prop(prop_path)
        except ValueError as err:
            self.main.statusBar().showMessage(str(err), 3000)
        except FileNotFoundError:
            self.main.statusBar().showMessage("Błędnie wybrany plik", 3000)

    def back_but_fun(self):
        self.main.windows_c.removeWidget(self.main.windows_c.currentWidget())

    def choose_but_fun(self):
        try:
            self.batcher.select_dir(
                QFileDialog.getExistingDirectory(self, "Wybierz folder źródłowy...", self.main.get_home_dir()))
            self.folder_name_label.setText(self.batcher.path)
        except ValueError as err:
            self.main.statusBar().showMessage(str(err), 3000)
        except FileNotFoundError:
            self.main.statusBar().showMessage("Błędnie wybrany katalog", 3000)

    def generate_preview(self):
        self.miniature_list_model.clear()
        try:
            self.batcher.set_prop('text', self.text_before_line.text())
            self.batcher.set_prop('digits', self.digits_amount_line.text())
            self.batcher.create_transformation_schema()
            for entry in self.batcher.transformation_schema_str.split('\n'):
                item = QStandardItem(entry)
                self.miniature_list_model.appendRow(item)
        except ValueError as err:
            self.main.statusBar().showMessage(str(err), 3000)

    def go_but_fun(self):
        try:
            self.batcher.check_dir(self.batcher.path)
            self.batcher.set_prop('text', self.text_before_line.text())
            self.batcher.set_prop('digits', self.digits_amount_line.text())
            self.batcher.start()
            self.main.windows_c.addWidget(self.progressWindow)
            self.main.windows_c.setCurrentWidget(self.progressWindow)
            self.progressWindow.start()
        except ValueError as err:
            self.main.statusBar().showMessage(str(err), 3000)
    def __init__(self, main, title_font_size, button_size_w, button_size_h, button_font_size, subtitle_font_size):
        super().__init__()

        self.main = main
        self.batcher = Watermarker()
        self.progressWindow = ProgressWindow(self.main, 'Dodawanie znaku wodnego', self.batcher, 32, 0, 0, 12, 22)

        # deklaracja napisow

        title = QLabel('Znak wodny')

        label_font = title.font()
        label_font.setPointSize(title_font_size)
        label_font.setBold(True)
        title.setFont(label_font)

        source_folder_label = QLabel('Folder źródłowy: ')
        dest_folder_label = QLabel('Folder docelowy: ')
        watermark_label = QLabel('Znak wodny: ')
        position_label = QLabel('Położenie: ')
        quality_label = QLabel('Jakość: ')

        self.source_path_label = QLabel('')
        self.dest_path_label = QLabel('')
        self.watermark_path_label = QLabel('')

        # deklaracja przyciskow

        back_but = QPushButton('wstecz')
        choose_source_but = QPushButton('Wybierz folder...')
        choose_dest_but = QPushButton('Wybierz folder...')
        choose_watermark = QPushButton('Wybierz plik...')
        import_but = QPushButton('Import ustawień...')
        export_but = QPushButton('Eksport ustawień...')
        go_but = QPushButton('GO!')

        go_but.setFixedSize(button_size_w, button_size_h)
        but_font = go_but.font()
        but_font.setPointSize(button_font_size)
        go_but.setFont(but_font)

        #drop-down list

        self.position_list = QComboBox()
        self.position_list.addItem('--- Wybierz opcje ---', '')
        self.position_list.addItem('lewa góra', 'top-left')
        self.position_list.addItem('prawa góra', 'top-right')
        self.position_list.addItem('prawy dół', 'bottom-right')
        self.position_list.addItem('lewy dół', 'bottom-left')
        self.position_list.setFixedWidth(150)

        #edit-liny
        self.quality_line = QLineEdit()

        # layout

        quality_layout = QHBoxLayout()
        quality_layout.addWidget(quality_label)
        quality_layout.addWidget(self.quality_line)
        quality_layout.addStretch()

        title_layout = QHBoxLayout()
        title_layout.addWidget(back_but)
        title_layout.addWidget(title)
        title_layout.addStretch()

        choose_source_folder_layout = QHBoxLayout()
        choose_source_folder_layout.addWidget(source_folder_label)
        choose_source_folder_layout.addWidget(choose_source_but)
        choose_source_folder_layout.addWidget(self.source_path_label)
        choose_source_folder_layout.addStretch()
        
        choose_dest_folder_layout = QHBoxLayout()
        choose_dest_folder_layout.addWidget(dest_folder_label)
        choose_dest_folder_layout.addWidget(choose_dest_but)
        choose_dest_folder_layout.addWidget(self.dest_path_label)
        choose_dest_folder_layout.addStretch()

        choose_layout = QVBoxLayout()
        choose_layout.addLayout(choose_source_folder_layout)
        choose_layout.addLayout(choose_dest_folder_layout)

        watermark_file_layout = QHBoxLayout()
        watermark_file_layout.addWidget(watermark_label)
        watermark_file_layout.addWidget(choose_watermark)
        watermark_file_layout.addWidget(self.watermark_path_label)
        watermark_file_layout.addStretch()

        position_layout = QHBoxLayout()
        position_layout.addWidget(position_label)
        position_layout.addWidget(self.position_list)
        position_layout.addStretch()

        watermark_layout = QVBoxLayout()
        watermark_layout.addLayout(watermark_file_layout)
        watermark_layout.addLayout(position_layout)
        watermark_layout.addLayout(quality_layout)

        choose_watermark_layout = QHBoxLayout()
        choose_watermark_layout.addLayout(watermark_layout)
        choose_watermark_layout.addLayout(choose_layout)

        exp_imp_but_layout = QHBoxLayout()
        exp_imp_but_layout.addStretch(2)
        exp_imp_but_layout.addWidget(import_but)
        exp_imp_but_layout.addWidget(export_but)
        exp_imp_but_layout.addStretch(2)

        go_but_layout = QHBoxLayout()
        go_but_layout.addStretch()
        go_but_layout.addWidget(go_but)
        go_but_layout.addStretch()

        main_layout = QVBoxLayout()
        main_layout.addLayout(title_layout)
        main_layout.addWidget(self.main.h_line())
        main_layout.addStretch()
        main_layout.addLayout(choose_watermark_layout)
        main_layout.addStretch()
        main_layout.addWidget(self.main.h_line())
        main_layout.addStretch()
        main_layout.addLayout(exp_imp_but_layout)
        main_layout.addStretch()
        main_layout.addWidget(self.main.h_line())
        main_layout.addStretch()
        main_layout.addLayout(go_but_layout)
        main_layout.addStretch()

        self.setLayout(main_layout)

        # podpiecia przyciskow

        choose_watermark.clicked.connect(self.choose_watermark_but_fun)
        back_but.clicked.connect(self.back_but_fun)
        choose_source_but.clicked.connect(self.choose_but_fun)
        choose_dest_but.clicked.connect(self.choose_dest_but_fun)
        import_but.clicked.connect(self.import_settings)
        export_but.clicked.connect(self.export_settings)

        go_but.clicked.connect(self.go_but_fun)
class WatermarkWindow(QWidget):
    def __init__(self, main, title_font_size, button_size_w, button_size_h, button_font_size, subtitle_font_size):
        super().__init__()

        self.main = main
        self.batcher = Watermarker()
        self.progressWindow = ProgressWindow(self.main, 'Dodawanie znaku wodnego', self.batcher, 32, 0, 0, 12, 22)

        # deklaracja napisow

        title = QLabel('Znak wodny')

        label_font = title.font()
        label_font.setPointSize(title_font_size)
        label_font.setBold(True)
        title.setFont(label_font)

        source_folder_label = QLabel('Folder źródłowy: ')
        dest_folder_label = QLabel('Folder docelowy: ')
        watermark_label = QLabel('Znak wodny: ')
        position_label = QLabel('Położenie: ')
        quality_label = QLabel('Jakość: ')

        self.source_path_label = QLabel('')
        self.dest_path_label = QLabel('')
        self.watermark_path_label = QLabel('')

        # deklaracja przyciskow

        back_but = QPushButton('wstecz')
        choose_source_but = QPushButton('Wybierz folder...')
        choose_dest_but = QPushButton('Wybierz folder...')
        choose_watermark = QPushButton('Wybierz plik...')
        import_but = QPushButton('Import ustawień...')
        export_but = QPushButton('Eksport ustawień...')
        go_but = QPushButton('GO!')

        go_but.setFixedSize(button_size_w, button_size_h)
        but_font = go_but.font()
        but_font.setPointSize(button_font_size)
        go_but.setFont(but_font)

        #drop-down list

        self.position_list = QComboBox()
        self.position_list.addItem('--- Wybierz opcje ---', '')
        self.position_list.addItem('lewa góra', 'top-left')
        self.position_list.addItem('prawa góra', 'top-right')
        self.position_list.addItem('prawy dół', 'bottom-right')
        self.position_list.addItem('lewy dół', 'bottom-left')
        self.position_list.setFixedWidth(150)

        #edit-liny
        self.quality_line = QLineEdit()

        # layout

        quality_layout = QHBoxLayout()
        quality_layout.addWidget(quality_label)
        quality_layout.addWidget(self.quality_line)
        quality_layout.addStretch()

        title_layout = QHBoxLayout()
        title_layout.addWidget(back_but)
        title_layout.addWidget(title)
        title_layout.addStretch()

        choose_source_folder_layout = QHBoxLayout()
        choose_source_folder_layout.addWidget(source_folder_label)
        choose_source_folder_layout.addWidget(choose_source_but)
        choose_source_folder_layout.addWidget(self.source_path_label)
        choose_source_folder_layout.addStretch()
        
        choose_dest_folder_layout = QHBoxLayout()
        choose_dest_folder_layout.addWidget(dest_folder_label)
        choose_dest_folder_layout.addWidget(choose_dest_but)
        choose_dest_folder_layout.addWidget(self.dest_path_label)
        choose_dest_folder_layout.addStretch()

        choose_layout = QVBoxLayout()
        choose_layout.addLayout(choose_source_folder_layout)
        choose_layout.addLayout(choose_dest_folder_layout)

        watermark_file_layout = QHBoxLayout()
        watermark_file_layout.addWidget(watermark_label)
        watermark_file_layout.addWidget(choose_watermark)
        watermark_file_layout.addWidget(self.watermark_path_label)
        watermark_file_layout.addStretch()

        position_layout = QHBoxLayout()
        position_layout.addWidget(position_label)
        position_layout.addWidget(self.position_list)
        position_layout.addStretch()

        watermark_layout = QVBoxLayout()
        watermark_layout.addLayout(watermark_file_layout)
        watermark_layout.addLayout(position_layout)
        watermark_layout.addLayout(quality_layout)

        choose_watermark_layout = QHBoxLayout()
        choose_watermark_layout.addLayout(watermark_layout)
        choose_watermark_layout.addLayout(choose_layout)

        exp_imp_but_layout = QHBoxLayout()
        exp_imp_but_layout.addStretch(2)
        exp_imp_but_layout.addWidget(import_but)
        exp_imp_but_layout.addWidget(export_but)
        exp_imp_but_layout.addStretch(2)

        go_but_layout = QHBoxLayout()
        go_but_layout.addStretch()
        go_but_layout.addWidget(go_but)
        go_but_layout.addStretch()

        main_layout = QVBoxLayout()
        main_layout.addLayout(title_layout)
        main_layout.addWidget(self.main.h_line())
        main_layout.addStretch()
        main_layout.addLayout(choose_watermark_layout)
        main_layout.addStretch()
        main_layout.addWidget(self.main.h_line())
        main_layout.addStretch()
        main_layout.addLayout(exp_imp_but_layout)
        main_layout.addStretch()
        main_layout.addWidget(self.main.h_line())
        main_layout.addStretch()
        main_layout.addLayout(go_but_layout)
        main_layout.addStretch()

        self.setLayout(main_layout)

        # podpiecia przyciskow

        choose_watermark.clicked.connect(self.choose_watermark_but_fun)
        back_but.clicked.connect(self.back_but_fun)
        choose_source_but.clicked.connect(self.choose_but_fun)
        choose_dest_but.clicked.connect(self.choose_dest_but_fun)
        import_but.clicked.connect(self.import_settings)
        export_but.clicked.connect(self.export_settings)

        go_but.clicked.connect(self.go_but_fun)

    def back_but_fun(self):
        self.main.windows_c.removeWidget(self.main.windows_c.currentWidget())

    @staticmethod
    def set_combobox(combobox, user_data):
        for index in range(combobox.count()):
            if combobox.itemData(index) == user_data:
                combobox.setCurrentIndex(index)

    def import_settings(self):
        try:
            prop_path = QFileDialog.getOpenFileName(self, "Wczytaj ustawienia...", self.main.get_home_dir())
            self.batcher.load_prop(prop_path)
            self.watermark_path_label.setText(str(self.batcher.prop['watermark_source']))
            self.quality_line.setText(str(self.batcher.prop['quality']))
            self.dest_path_label.setText(str(self.batcher.prop['destination']))
            self.set_combobox(self.position_list, self.batcher.prop['pasting_corner'])
        except ValueError as err:
            self.main.statusBar().showMessage(str(err), 3000)
        except FileNotFoundError:
            self.main.statusBar().showMessage("Błędnie wybrany plik", 3000)
        except NameError:
            self.main.statusBar().showMessage("Wczytano nieodpowiedni plik", 3000)

    def export_settings(self):
        try:
            self.batcher.set_prop('watermark_source', self.watermark_path_label.text())
            self.batcher.set_prop('quality', self.quality_line.text())
            self.batcher.set_prop('destination', self.dest_path_label.text())
            self.batcher.set_prop('pasting_corner', str(self.position_list.itemData(self.position_list.currentIndex())))
            prop_path = QFileDialog.getSaveFileName(self, "Zapisz ustawienia...", self.main.get_home_dir())
            self.batcher.save_prop(prop_path)
        except ValueError as err:
            self.main.statusBar().showMessage(str(err), 3000)
        except FileNotFoundError:
            self.main.statusBar().showMessage("Błędnie wybrany plik", 3000)

    def choose_but_fun(self):
        try:
            self.batcher.select_dir(
                QFileDialog.getExistingDirectory(self, "Wybierz folder źródłowy...", self.main.get_home_dir()))
            self.source_path_label.setText(self.batcher.path)
        except ValueError as err:
            self.main.statusBar().showMessage(str(err), 3000)
        except FileNotFoundError:
            self.main.statusBar().showMessage("Błędnie wybrany katalog", 3000)

    def choose_dest_but_fun(self):
        try:
            self.dest_path_label.setText(
                QFileDialog.getExistingDirectory(self, "Wybierz folder docelowy...", self.main.get_home_dir()))
        except FileNotFoundError:
            self.main.statusBar().showMessage("Błędnie wybrany katalog", 3000)

    def choose_watermark_but_fun(self):
        try:
            self.watermark_path_label.setText(
                QFileDialog.getOpenFileName(self, "Wybierz znak wodny...", self.main.get_home_dir()))
        except FileNotFoundError:
            self.main.statusBar().showMessage("Błędnie wybrany katalog", 3000)

    def go_but_fun(self):
        try:
            self.batcher.check_dir(self.batcher.path)
            self.batcher.set_prop('watermark_source', self.watermark_path_label.text())
            self.batcher.set_prop('quality', self.quality_line.text())
            self.batcher.set_prop('destination', self.dest_path_label.text())
            self.batcher.set_prop('pasting_corner', str(self.position_list.itemData(self.position_list.currentIndex())))
            self.batcher.start()
            self.main.windows_c.addWidget(self.progressWindow)
            self.main.windows_c.setCurrentWidget(self.progressWindow)
            self.progressWindow.start()
        except ValueError as err:
            self.main.statusBar().showMessage(str(err), 3000)
    def __init__(self, main, title_font_size, button_size_w, button_size_h, button_font_size, subtitle_font_size):
        super().__init__()

        self.batcher = Resizer()
        self.main = main
        self.progressWindow = ProgressWindow(self.main, "Stwórz miniatury", self.batcher, 32, 0, 0, 12, 22)

        # deklaracja napisow

        title = QLabel("Stwórz miniatury")

        label_font = title.font()
        label_font.setPointSize(title_font_size)
        label_font.setBold(True)
        title.setFont(label_font)

        self.folder_name_label = QLabel("")
        self.folder_dest_name_label = QLabel("")

        width_label = QLabel("Szerokość: ")
        height_label = QLabel("Wysokość: ")
        folder_dest_label = QLabel("Folder docelowy: ")
        quality_label = QLabel("Jakość: ")

        # deklaracja przyciskow

        back_but = QPushButton("wstecz")
        choose_but = QPushButton("Wybierz folder...")
        import_but = QPushButton("Import ustawień...")
        export_but = QPushButton("Eksport ustawień...")
        choose_dest_but = QPushButton("Wybierz...")
        go_but = QPushButton("GO!")

        go_but.setFixedSize(button_size_w, button_size_h)
        but_font = go_but.font()
        but_font.setPointSize(button_font_size)
        go_but.setFont(but_font)

        # deklaracja editline'ow

        self.width_line = QLineEdit()
        self.height_line = QLineEdit()
        self.quality_line = QLineEdit()

        self.width_line.setFixedWidth(50)
        self.height_line.setFixedWidth(50)
        self.quality_line.setFixedWidth(50)

        # layout

        title_layout = QHBoxLayout()
        title_layout.addWidget(back_but)
        title_layout.addWidget(title)
        title_layout.addStretch()

        choose_folder_layout = QHBoxLayout()
        choose_folder_layout.addWidget(choose_but)
        choose_folder_layout.addWidget(self.folder_name_label)
        choose_folder_layout.addStretch()

        import_layout = QHBoxLayout()
        import_layout.addWidget(import_but)
        import_layout.addStretch()

        export_layout = QHBoxLayout()
        export_layout.addWidget(export_but)
        export_layout.addStretch()

        width_layout = QHBoxLayout()
        width_layout.addWidget(width_label)
        width_layout.addWidget(self.width_line)
        width_layout.addWidget(QLabel("px"))
        width_layout.addStretch()

        height_layout = QHBoxLayout()
        height_layout.addWidget(height_label)
        height_layout.addWidget(self.height_line)
        height_layout.addWidget(QLabel("px"))
        height_layout.addStretch()

        left_layout = QVBoxLayout()
        left_layout.addLayout(import_layout)
        left_layout.addLayout(width_layout)
        left_layout.addLayout(height_layout)

        folder_dest_layout = QHBoxLayout()
        folder_dest_layout.addWidget(folder_dest_label)
        folder_dest_layout.addWidget(choose_dest_but)
        folder_dest_layout.addWidget(self.folder_dest_name_label)
        folder_dest_layout.addStretch()

        quality_layout = QHBoxLayout()
        quality_layout.addWidget(quality_label)
        quality_layout.addWidget(self.quality_line)
        quality_layout.addStretch()

        right_layout = QVBoxLayout()
        right_layout.addLayout(export_layout)
        right_layout.addLayout(folder_dest_layout)
        right_layout.addLayout(quality_layout)

        left_right_layout = QHBoxLayout()
        left_right_layout.addLayout(left_layout)
        left_right_layout.addLayout(right_layout)

        go_but_layout = QHBoxLayout()
        go_but_layout.addStretch()
        go_but_layout.addWidget(go_but)
        go_but_layout.addStretch()

        main_layout = QVBoxLayout()
        main_layout.addLayout(title_layout)
        main_layout.addWidget(self.main.h_line())
        main_layout.addLayout(choose_folder_layout)
        main_layout.addWidget(self.main.h_line())
        main_layout.addLayout(left_right_layout)
        main_layout.addWidget(self.main.h_line())
        main_layout.addLayout(go_but_layout)

        self.setLayout(main_layout)

        # podpiecia przyciskow

        back_but.clicked.connect(self.back_but_fun)
        choose_but.clicked.connect(self.choose_but_fun)
        choose_dest_but.clicked.connect(self.choose_dest_but_fun)
        import_but.clicked.connect(self.import_settings)
        export_but.clicked.connect(self.export_settings)

        go_but.clicked.connect(self.go_but_fun)
class CreateMiniatureWindow(QWidget):
    def __init__(self, main, title_font_size, button_size_w, button_size_h, button_font_size, subtitle_font_size):
        super().__init__()

        self.batcher = Resizer()
        self.main = main
        self.progressWindow = ProgressWindow(self.main, "Stwórz miniatury", self.batcher, 32, 0, 0, 12, 22)

        # deklaracja napisow

        title = QLabel("Stwórz miniatury")

        label_font = title.font()
        label_font.setPointSize(title_font_size)
        label_font.setBold(True)
        title.setFont(label_font)

        self.folder_name_label = QLabel("")
        self.folder_dest_name_label = QLabel("")

        width_label = QLabel("Szerokość: ")
        height_label = QLabel("Wysokość: ")
        folder_dest_label = QLabel("Folder docelowy: ")
        quality_label = QLabel("Jakość: ")

        # deklaracja przyciskow

        back_but = QPushButton("wstecz")
        choose_but = QPushButton("Wybierz folder...")
        import_but = QPushButton("Import ustawień...")
        export_but = QPushButton("Eksport ustawień...")
        choose_dest_but = QPushButton("Wybierz...")
        go_but = QPushButton("GO!")

        go_but.setFixedSize(button_size_w, button_size_h)
        but_font = go_but.font()
        but_font.setPointSize(button_font_size)
        go_but.setFont(but_font)

        # deklaracja editline'ow

        self.width_line = QLineEdit()
        self.height_line = QLineEdit()
        self.quality_line = QLineEdit()

        self.width_line.setFixedWidth(50)
        self.height_line.setFixedWidth(50)
        self.quality_line.setFixedWidth(50)

        # layout

        title_layout = QHBoxLayout()
        title_layout.addWidget(back_but)
        title_layout.addWidget(title)
        title_layout.addStretch()

        choose_folder_layout = QHBoxLayout()
        choose_folder_layout.addWidget(choose_but)
        choose_folder_layout.addWidget(self.folder_name_label)
        choose_folder_layout.addStretch()

        import_layout = QHBoxLayout()
        import_layout.addWidget(import_but)
        import_layout.addStretch()

        export_layout = QHBoxLayout()
        export_layout.addWidget(export_but)
        export_layout.addStretch()

        width_layout = QHBoxLayout()
        width_layout.addWidget(width_label)
        width_layout.addWidget(self.width_line)
        width_layout.addWidget(QLabel("px"))
        width_layout.addStretch()

        height_layout = QHBoxLayout()
        height_layout.addWidget(height_label)
        height_layout.addWidget(self.height_line)
        height_layout.addWidget(QLabel("px"))
        height_layout.addStretch()

        left_layout = QVBoxLayout()
        left_layout.addLayout(import_layout)
        left_layout.addLayout(width_layout)
        left_layout.addLayout(height_layout)

        folder_dest_layout = QHBoxLayout()
        folder_dest_layout.addWidget(folder_dest_label)
        folder_dest_layout.addWidget(choose_dest_but)
        folder_dest_layout.addWidget(self.folder_dest_name_label)
        folder_dest_layout.addStretch()

        quality_layout = QHBoxLayout()
        quality_layout.addWidget(quality_label)
        quality_layout.addWidget(self.quality_line)
        quality_layout.addStretch()

        right_layout = QVBoxLayout()
        right_layout.addLayout(export_layout)
        right_layout.addLayout(folder_dest_layout)
        right_layout.addLayout(quality_layout)

        left_right_layout = QHBoxLayout()
        left_right_layout.addLayout(left_layout)
        left_right_layout.addLayout(right_layout)

        go_but_layout = QHBoxLayout()
        go_but_layout.addStretch()
        go_but_layout.addWidget(go_but)
        go_but_layout.addStretch()

        main_layout = QVBoxLayout()
        main_layout.addLayout(title_layout)
        main_layout.addWidget(self.main.h_line())
        main_layout.addLayout(choose_folder_layout)
        main_layout.addWidget(self.main.h_line())
        main_layout.addLayout(left_right_layout)
        main_layout.addWidget(self.main.h_line())
        main_layout.addLayout(go_but_layout)

        self.setLayout(main_layout)

        # podpiecia przyciskow

        back_but.clicked.connect(self.back_but_fun)
        choose_but.clicked.connect(self.choose_but_fun)
        choose_dest_but.clicked.connect(self.choose_dest_but_fun)
        import_but.clicked.connect(self.import_settings)
        export_but.clicked.connect(self.export_settings)

        go_but.clicked.connect(self.go_but_fun)

    def import_settings(self):
        try:
            prop_path = QFileDialog.getOpenFileName(self, "Wczytaj ustawienia...", self.main.get_home_dir())
            self.batcher.load_prop(prop_path)
            self.width_line.setText(str(self.batcher.prop["size"][0]))
            self.height_line.setText(str(self.batcher.prop["size"][1]))
            self.quality_line.setText(str(self.batcher.prop["quality"]))
            self.folder_dest_name_label.setText(str(self.batcher.prop["destination"]))
        except ValueError as err:
            self.main.statusBar().showMessage(str(err), 3000)
        except FileNotFoundError:
            self.main.statusBar().showMessage("Błędnie wybrany plik", 3000)
        except NameError:
            self.main.statusBar().showMessage("Wczytano nieodpowiedni plik", 3000)

    def export_settings(self):
        try:
            self.batcher.set_prop("size", (self.width_line.text(), self.height_line.text()))
            self.batcher.set_prop("quality", self.quality_line.text())
            self.batcher.set_prop("destination", self.folder_dest_name_label.text())
            prop_path = QFileDialog.getSaveFileName(self, "Zapisz ustawienia...", self.main.get_home_dir())
            self.batcher.save_prop(prop_path)
        except ValueError as err:
            self.main.statusBar().showMessage(str(err), 3000)
        except FileNotFoundError:
            self.main.statusBar().showMessage("Błędnie wybrany plik", 3000)

    def back_but_fun(self):
        self.main.windows_c.removeWidget(self.main.windows_c.currentWidget())

    def choose_but_fun(self):
        try:
            self.batcher.select_dir(
                QFileDialog.getExistingDirectory(self, "Wybierz folder źródłowy...", self.main.get_home_dir())
            )
            self.folder_name_label.setText(self.batcher.path)
        except ValueError as err:
            self.main.statusBar().showMessage(str(err), 3000)
        except FileNotFoundError:
            self.main.statusBar().showMessage("Błędnie wybrany katalog", 3000)

    def choose_dest_but_fun(self):
        try:
            self.folder_dest_name_label.setText(
                QFileDialog.getExistingDirectory(self, "Wybierz folder docelowy...", self.main.get_home_dir())
            )
        except FileNotFoundError:
            self.main.statusBar().showMessage("Błędnie wybrany katalog", 3000)

    def go_but_fun(self):
        try:
            self.batcher.check_dir(self.batcher.path)
            self.batcher.set_prop("size", (self.width_line.text(), self.height_line.text()))
            self.batcher.set_prop("quality", self.quality_line.text())
            self.batcher.set_prop("destination", self.folder_dest_name_label.text())
            self.batcher.start()
            self.main.windows_c.addWidget(self.progressWindow)
            self.main.windows_c.setCurrentWidget(self.progressWindow)
            self.progressWindow.start()
        except ValueError as err:
            self.main.statusBar().showMessage(str(err), 3000)