[Eric] Extras - Wizards -> Main

Jürgen Urner jUrner at arcor.de
Sun Jan 28 14:06:42 GMT 2007


Carles Pina i Estany schrieb:
> 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.
>>
>>     


I guess this can be easily done by setting up your own environment
for scripts. Instead of running the script the usual way, you could
setup a tool wich is calling python to execute a script wich wraps
the one you want to exec to do all the required magic.......


Tools --> MyTool

MyTool.py

if __name__ == '__main__':
    my_scripts_path = sys.argv[1]
    # do python magic here to get the main class from the script passed
    my_scripts_module = apply_magic(my_scripts_path) *
  
    app=QtGui.QApplication(sys.argv)
    window= my_scripts_module.MainWindow()
    window.show()
     sys.exit(app.exec_())



*apply_magic() ~ 'exec module in dict' should work for most

Jürgen














 






More information about the Eric mailing list