from PyQt6.QtWidgets import QDialog
from _import_dialog_Window import Ui_DialogImport

class DialogImport(QDialog, Ui_DialogImport):
    def __init__(self,*args,**kwargs):
        super(DialogImport,self).__init__(*args,**kwargs)
        self.setupUi(self)
        # self.import_dialog = UI_DialogImport()
        # self.ui_import_dialog = Ui_DialogImport()
        print('DialogImport')

    def is_shown(self):
        print(f'is_shown: {self.isVisible()}')
        return self.isVisible()

    def open_import_dialog(self):
        print(f'open_import_dialog: {self.is_shown()}')
        if not self.is_shown():
            print('Inside if  not self.is_shown')
            print('showing window')
            self.show()

    def close_import_dialog(self):
        print('close_import_dialog')
        if self.is_shown():
            print('inside self.is_shown()')
            print('hiding window')
            self.hide()

    def set_progress_importing(self, n):
        print("%d%% done" % n)
        self.progressBar_importing.setValue(int(n))
        self.lcd_import_progress.display(n)

    def set_progress_current_file(self, n):
        print("%d%% done" % n)
        self.progressBar_importing_2.setValue(int(n))
        self.lcd_current_file_progress.display(n)

    def set_importing_file(self,f):
        self.l_importing_file_name.setText(f)

    def add_to_imported_list(self,n):
        self.set_importing_file('')
        self.list_imported.addItem(n)