View Single Post
Old 07-07-2012, 01:53 PM   #49
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
Some code snippets should make things clearer.
(Colon's show where some lines of code have been skipped.)
Code:
ui.py has

from calibre_plugins.ag_normepub.main import PlugMain
:
    self.qaction.triggered.connect(self.show_dialog)
:
    def show_dialog(self):
:
        ufig = self.interface_action_base_plugin.do_user_config
        plug = PlugMain(self.gui, self.qaction.icon(), ufig)
        plug.show()

main.py has:

class PlugMain(QDialog):

    def __init__(self, gui, icon, ufig):

        self.gui = gui
        self.ufig = ufig
        QDialog.__init__(self, gui)
:
        self.btn_norm = QPushButton('Normalise ePub', self)
        self.btn_norm.clicked.connect(self.normalise)
        self.lay.addWidget(self.btn_norm)
:
    def normalise(self):
:
and normalise does all the work. So I want get rid of this QDialog but I can't delete the whole class as normalise() is defined within it.
Agama is offline   Reply With Quote