def __init__(self, glyph, callback, x, y): self.glyph = glyph self.callback = callback # create the modal dialog (from dialogKit) self.w = ModalDialog((200, 150), "Shapes Tool", okCallback=self.okCallback, cancelCallback=self.cancelCallback) # add some text boxes self.w.xText = TextBox((10, 43, 100, 22), "x") self.w.wText = TextBox((10, 13, 100, 22), "w") self.w.yText = TextBox((100, 43, 100, 22), "y") self.w.hText = TextBox((100, 13, 100, 22), "h") # adding input boxes self.w.xInput = EditText((30, 40, 50, 22), "%i" % x) self.w.wInput = EditText((30, 10, 50, 22)) self.w.yInput = EditText((120, 40, 50, 22), "%i" % y) self.w.hInput = EditText((120, 10, 50, 22)) # a radio shape choice group # (the RadioGroup isn't standaard in dialogKit, this is a vanilla object) self.shapes = ["oval", "rect"] self.w.shape = RadioGroup((10, 70, -10, 22), self.shapes, isVertical=False) self.w.shape.set(0) self.w.open()
def __init__(self, message, value, title): self.w = ModalDialog((360, 140), title) self.w.button1 = Button((-100, -300, 80, 24), 'OK', callback=self.buttonCallback) self.w.t = TextBox((5, 10, -5, 27), message) self.w.inputValue = EditText((5, 35, -5, 50), value) self.w.open()
def __init__(self, message, default=None, title="RoboFab"): # default is ignord? self.answer = -1 self.w = ModalDialog((360, 140), title, okCallback=self.buttonOKCallback) self.w.noButton = Button((10, -35, 80, 24), 'No', callback=self.buttonNoCallback) self.w.t = TextBox((5, 10, -5, 27), message) self.w.open()
def __init__(self): self.w = ModalDialog((200, 120), 'Dump/Fuse', okCallback=self.okCallback) Selection = NSUserDefaults.standardUserDefaults().integerForKey_( "Fuse_Dump_DialogSelection") if Selection < 1 or Selection > 3: Selection = 2 self.w.dumpComp = CheckBox((10, 10, 180, 20), 'Dump components', value=(Selection == 1 or Selection == 3)) self.w.fuseComp = CheckBox((10, 40, 180, 20), 'Fuse components', value=(Selection == 2 or Selection == 3)) self.value = 0 self.w.open()
def __init__(self, items_list, title="select options", width=320, sort=False): self._title = title self._width = width self._height = (self._padding * 2) + ( (len(items_list) + 2) * self._box_height) + 50 # sort items if sort: tmp = list(items_list) tmp.sort() items_list = tuple(tmp) self._items_list = items_list # init window self.w = ModalDialog((self._width, self._height), self._title, okCallback=self.ok_callback, cancelCallback=self.cancel_callback) x = self._padding y = self._padding # select all / none self.w._select_all_checkbox = CheckBox( (x, y, -self._padding, self._box_height), 'select/deselect all', value=self._select_all, callback=self._select_all_callback) y += (self._box_height) # division line self.w.line = HorizontalLine((x, y, -self._padding, self._box_height)) # create checkboxes from list for item in self._items_list: self._add_checkbox(item) # open window self.w.open()
def __init__(self): self.w = ModalDialog((200, 120), 'Dump/Fuse', okCallback=self.okCallback) self.w.dumpComp = CheckBox((10, 10, 180, 20), 'Dump components', callback=self.dumpCompCallback) self.w.fuseComp = CheckBox((10, 40, 180, 20), 'Fuse components', callback=self.fuseCompCallback, value=True) self.value = 2 self.w.open()
def __init__(self, message, title): self.w = ModalDialog((360, 100), title) self.w.t = TextBox((5, 10, -5, -40), message) self.w.open()