Re: [Pythoncad-developer] Added command line support
CAD Application entire developed in Python
Status: Beta
Brought to you by:
matteoboscolo
|
From: Matteo B. <mat...@bo...> - 2010-04-03 06:51:05
|
Hi Gertwin,
I made some modification at the command PyCadBaseCommand ..
now it support messages ..
so the code in the below mail is wrong ..
use this instead:
cObject=self.__pyCadApplication.getCommand(cmd_Key)
for iv in cObject:
exception,message=iv #Now the iv contain a tuple with
exception + message
try:
raise exception(None)
except ExcPoint:
cObject[iv]=self.imputPoint(message)
You can find this modification at the last git push
I will be out of the net for the Easter period .. till 7-8 April ..I
wish you All (PythonCad Team ) a good Easter and all the best for your
family too.
Regards,
Matteo
On Sat, 2010-04-03 at 08:25 +0200, Matteo Boscolo wrote:
> Hi Gertwin,
>
>
> > I agree, the function parser is part of the kernel, not the interface.
> > I will look at the test_kernel.py for the drawing command structure.
> Could you make it part of the pycadapplication ?
>
> > We must also define a way to get information from the user, picking
> > points, selection etc.
> My command is an iterable object each element can rise an exception and
> tells you witch kind of data the command need ..
> This is a piece of code that show you how it works
>
> cObject=self.__pyCadApplication.getCommand(cmd_Key) # Get The command
> for iv in cObject:
> try:
> raise iv(None) #raise the exception
> except ExcPoint: #catch the exception
> cObject[iv]=self.imputPoint() #do the job in this
> case ask to the user to imput a point from the io
> ...
> ...
> at the end..
> else:
> cObject.applyCommand() #apply the command
>
> I need add the description method at the item exception ..
> so we can have the description from the given request...
> I let you know how it works as soon I have done the implementation..
>
> Do you have any experience in localization with python ?
>
> > My idea was to do this all by the function parser.
> I think that your function parser can parse the input from the user
> (menus,textInput,keybord command..)
> and call my getcommand to know witch kind of input to ask to the user to
> perform the given command
> Example:
> the user write the Segment command from the input box:
> the getCommand return a Segment command
> the parser look at the input parameter and ask at the user to give that
> request data ..
> at the end the parser apply the command
> you can fire some event for asking think to the userInterface.
>
> The user interface will be attached at this event and perform the action
> required from the user and from the pycadapplication ..
>
> > If we define a set of states (pick point, select object, etc.), on
> > each mouse move the interface can check the state and react on this.
> >
> > I agree about the class diagram, we should interact with more people
> > on the team.
> > If you know some kind of tool to generate class diagrams, we can put
> > them on the new wiki.
> I'm Working on it .. I'm trying http://epydoc.sourceforge.net/ pakage and let you know..
>
> Regards,
> Matteo
>
> > Regards,
> > Gertwin
> >
> > 2010/4/2 Matteo Boscolo <mat...@bo...>:
> > > Hi Gertwin,
> > >
> > > I sow your command line and it working well .. no bugs found ..
> > > Could we implement a Multi text viewer where pythoncad put the output
> > > If the command succeed say .. "o boy .. well done :-)"
> > >> The idea is that every module can register commands that it can handle.
> > > I like this idea, but I wold like that the interpret stay under kernel
> > > (pycadapplication)
> > >
> > > I had made some modification at the pythoncad structure ..
> > >
> > > now the main api file is not pycadkernel but pycadapplication ...
> > >
> > > I made this change to support the new command class ..
> > > This class have not the some functionality of your and is not intend to
> > > replace you class .. it's a generic api file in witch all the gui interface
> > > are interfaced ..
> > >
> > > This class will provide hight level functionality to perform drawing
> > > operation.
> > > for now I have implemented only the getCommand method ..
> > > this method give to you the command object so you can fill it with the
> > > needed value and perform the applyCommand method to apply the command..
> > >
> > > The following line will sow to you an exsample.
> > >
> > > cObject=pyCadApplication.getCommand("segment")
> > >
> > > for iv in cObject: #<<-- Loop for all the needed value
> > > try:
> > > raise iv(None) #<<-- Raise the exception of the needed value
> > > except ExcPoint: #<<-- if it's a point came here
> > > cObject[iv]=self.imputPoint() #<<--This is my io text imput But
> > > could be a function that ask to the user to pick a point
> > > except ExcLenght:
> > > cObject[iv]=self.inputMsg("Insert A Distance/Radius")
> > > except ExcAngle:
> > > cObject[iv]=self.inputMsg("Insert An angle")
> > > except:
> > > print "Bad error !!"
> > > raise
> > > else:
> > > cObject.applyCommand() #<<-- applay the command if all the data are
> > > right.
> > >
> > > you can find a working test if you run the test_kernel.py
> > >
> > > I intend to provide all the drawing command with this method ..
> > >
> > >
> > > Let me know what you are thinking about it..
> > > I think that your function Parser should be part of the pycadapplication and
> > > not part of the interface ..so let me know if you fill the some
> > >
> > > At this stage there is a lot of code written ..so for my point of view we
> > > have to make a class diagram and start to discuss at the new class structure
> > > ..so our work can be more profitable.
> > >
> > >
> > > Regards,
> > > Matteo
> > >
> > > On Wed, 2010-03-31 at 23:26 +0200, Gertwin Groen wrote:
> > >
> > > Hi Matteo,
> > >
> > > I have just pushed my latest version to git.
> > > It has preliminary support for a command line interface with a very
> > > very simple command interpreter.
> > >
> > > The idea is that every module can register commands that it can handle.
> > > Also I changed the menu structure, it also works by sending commands
> > > to the command interpreter.
> > >
> > > For now the program understands command like (case insensitive):
> > > OPEN
> > > REBUILD_IX
> > > QUIT
> > > REGEN
> > > REDRAW
> > > ZOOMA
> > >
> > > I think this is better than the R37 version because command line and
> > > menu was handled different.
> > > If you have some comments on this, please let me know.
> > >
> > > I did not test it much, so be prepared for bugs.
> > >
> > > Regards,
> > > Gertwin
> > >
> > >
> > >
> >
>
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Pythoncad-developer mailing list
> Pyt...@li...
> https://lists.sourceforge.net/lists/listinfo/pythoncad-developer
>
|