[Eric] Extras - Wizards -> Main

Detlev Offenbach detlev at die-offenbachs.de
Sun Jan 28 14:57:37 GMT 2007


Hi,

I think a wizard for this is a little bit of overkill. A template with two 
variables is to be used here. One would hold the module name of your form, 
the other your form name. This could look like

from PyQt4 import QtCore,QtGui
from $ui_module$ import *

class MainWindow(QtGui.QMainWindow):
        def __init__(self):
                QtGui.QMainWindow.__init__(self)
                self.ui = $ui_name$()
                self.ui.setupUi(self)

if __name__=="__main__":
    app=QtGui.QApplication(sys.argv)
    window=MainWindow()
    window.show()
    sys.exit(app.exec_())

If you apply this template with the cursor at the right place in an editor, it 
will ask for values for these two variables and replace them and insert the 
text at the cursor position. If you enable the option "Autocompile changed 
forms" on the Project configuration page, your form file will be compiled the 
next time you run/debug/... your project.

I think, eric already contains everything to solve your problem.

Detlev

On Sunday 28 January 2007 14:28, Carles Pina i Estany wrote:
> Hi!
>
> I sent below mail on 15 and 20 Jan without any answer. I don't know if:
> a) people haven't understood me
> b) is a silly option
> c) is not interesting option :-) so people don't answer it :-)
>
> As I think that would be interesting, I could even program* in Eric (if
> Detlev thinks that is interesting but he is not interested to do).
>
> *: maybe this week or maybe in some weeks (I am waiting to know if I
> will have some free time this week or I will have to do other things)
>
> Have a nice Sunday :-)
>
> On Jan/15/2007, Carles Pina i Estany wrote:
> > Hello,
> >
> > (this is the last mail with my comments and wishes, I don't have more
> > comments/wishes about Eric :-) -by the moment!)
> >
> > Note: I am still using version 3.9.1, if this is already implemented in
> > Eric4 sorry for the noise.
> >
> > User case of my idea:
> > -User creates a new project
> > -User makes a new formulary
> > Now users wants to have a "new application", I mean, to execute this
> > formulary.
> >
> > Usually I do something similar to:
> > from PyQt4 import QtCore,QtGui
> > from Ui_main import *
> >
> > class MainWindow(QtGui.QMainWindow):
> >         def __init__(self):
> >                 QtGui.QMainWindow.__init__(self)
> >                 self.ui = Ui_Principal()
> >                 self.ui.setupUi(self)
> >
> > if __name__=="__main__":
> >     app=QtGui.QApplication(sys.argv)
> >     window=MainWindow()
> >     window.show()
> >     sys.exit(app.exec_())
> >
> > I think that would be very goodthat user is able to do Extras - Wizards
> > - Main Window, then that Eric asks to user "in which file do you
> > have the formulary?" user selects the file and then form is compiled
> > and that code (or little better, i found it in some program that I
> > did) is written. Notice that from Ui_main is the file that user
> > would select, Ui_Principal is the name of form and has to be taken from
> > .ui file, etc.
> >
> > The same concept (I can provide the code, but I am sure that you
> > Detlev has this code) to create a class importing from a formulary.
> > Even is so similar that could be in same options and checking if .ui
> > file is a Dialog or MainWindow, or something like this.
> >
> > In my opinion, this would do Eric so much better.
> >
> > PD: and optionally, could create this code:
> >         @QtCore.pyqtSignature("")
> >         def on_casquet_clicked(self):
> > 		##Type your button code here
> >
> > if .ui has some buttons, already.
> >
> > Thanks for the attention!
> >
> > --
> > Carles Pina i Estany		GPG id: 0x8CBDAE64
> > 	http://pinux.info	Manresa - Barcelona
> > _______________________________________________
> > Eric mailing list
> > Eric at riverbankcomputing.com
> > http://www.riverbankcomputing.com/mailman/listinfo/eric

-- 
Detlev Offenbach
detlev at die-offenbachs.de


More information about the Eric mailing list