On 08/12/2015 at 18:54, xxxxxxxx wrote:
Hello guys,
just a stupid but id-like-to-know question. I have a CommandData with GeDialog for user input. Usually I do stuff in GeDialog->Command->if id == BUTTON_OK. But Im not sure if it is the recommended way. So, where do I have to do stuff?
class MyDialog(gui.GeDialog) :
refs = None
def CreateLayout(self) :
self.SetTitle('Commandtest')
self.GroupBegin(10001, c4d.BFH_LEFT, 1, 1)
self.AddEditNumberArrows(10004, c4d.BFH_LEFT, initw=150, inith=0)
self.AddButton(10002, c4d.BFH_LEFT, name='OK')
self.AddButton(10003, c4d.BFH_LEFT, name='Cancel')
self.GroupEnd()
return True
def InitValues(self) :
return True
def Command(self, id, msg) :
if id==10003: self.Close()
elif id==10002: pass
return True
class CommandTest(plugins.CommandData) :
dialog = None
def Execute(self, doc) :
if self.dialog is None: self.dialog = MyDialog()
return self.dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, pluginid=PLUGIN_ID, defaultw=300, defaulth=0)
def RestoreLayout(self, sec_ref) :
if self.dialog is None: self.dialog = MyDialog()
return self.dialog.Restore(pluginid=PLUGIN_ID, secret=sec_ref)
if __name__ == "__main__":
bmp = bitmaps.BaseBitmap()
dir, f = os.path.split(__file__)
fn = os.path.join(dir, "", "icon.tif")
bmp.InitWith(fn)
plugins.RegisterCommandPlugin(id=PLUGIN_ID,
str="CommandTest",
info=0,
help="CommandTest",
dat=CommandTest(),
icon=bmp)
Thx and greetings
rownn