View Single Post
Old 05-22-2022, 03:52 PM   #151
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 974
Karma: 3600000
Join Date: Jan 2017
Location: Poland
Device: Various
@DiapDealer:
I thought you could add extra error handling, but it turns out that in qtdialogs.py you have to check for smap and css files first, and if they are not there (and the checkboxes are checked) the whole dialogbox returns default values, so the DOCX file also is "None".

Since the existence of smap and css files is not crucial to the operation of the plugin, you can probably just add messages directly in qtdialogs.py instead of "return".
The user will be better informed and the plugin will still work.

You don't need to change anything at tkdialogs.py.

Spoiler:
Code:
        if self.checkbox_smap.isChecked():
            if len(self.cust_smap_path.text()):
                self.prefs['useSmapPath'] = self.cust_smap_path.text()
                _DETAILS['smap'] = (self.checkbox_smap.isChecked(), self.cust_smap_path.text())
            else:
                # Message box that no file is selected
                # return
                print("Not selected smap file!")
        self.prefs['useCss'] = self.checkbox_css.isChecked()
        if self.checkbox_css.isChecked():
            if len(self.cust_css_path.text()):
                self.prefs['useCssPath'] = self.cust_css_path.text()
                _DETAILS['css'] = (self.checkbox_css.isChecked(), self.cust_css_path.text())
            else:
                # Message box that no file is selected
                # return
                print("Not selected css file!")


Perhaps you will find a better solution.
BeckyEbook is offline   Reply With Quote