(self, culebron)
| 2113 | epId = None |
| 2114 | |
| 2115 | def __init__(self, culebron): |
| 2116 | self.culebron = culebron |
| 2117 | self.parent = culebron.window |
| 2118 | tkinter.Toplevel.__init__(self, self.parent) |
| 2119 | self.transient(self.parent) |
| 2120 | self.culebron.setDragDialogShowed(True) |
| 2121 | self.title("Drag: selecting parameters") |
| 2122 | self.__grabbing = None |
| 2123 | self.ok = None |
| 2124 | |
| 2125 | # valid percent substitutions (from the Tk entry man page) |
| 2126 | # %d = Type of action (1=insert, 0=delete, -1 for others) |
| 2127 | # %i = index of char string to be inserted/deleted, or -1 |
| 2128 | # %P = value of the entry if the edit is allowed |
| 2129 | # %s = value of entry prior to editing |
| 2130 | # %S = the text string being inserted or deleted, if any |
| 2131 | # %v = the type of validation that is currently set |
| 2132 | # %V = the type of validation that triggered the callback |
| 2133 | # (key, focusin, focusout, forced) |
| 2134 | # %W = the tk name of the widget |
| 2135 | self.validate = (self.parent.register(self.onValidate), '%P') |
| 2136 | self.sp = LabeledEntryWithButton(self, "Start point", "Grab", command=self.onGrabSp, validate="focusout", |
| 2137 | validatecmd=self.validate) |
| 2138 | self.sp.grid(row=1, column=1, columnspan=3, pady=5) |
| 2139 | |
| 2140 | self.ep = LabeledEntryWithButton(self, "End point", "Grab", command=self.onGrabEp, validate="focusout", |
| 2141 | validatecmd=self.validate) |
| 2142 | self.ep.grid(row=2, column=1, columnspan=3, pady=5) |
| 2143 | |
| 2144 | l = tkinter.Label(self, text="Units") |
| 2145 | l.grid(row=3, column=1, sticky=tkinter.E) |
| 2146 | |
| 2147 | self.units = tkinter.StringVar() |
| 2148 | self.units.set(Unit.DIP) |
| 2149 | col = 2 |
| 2150 | for u in dir(Unit): |
| 2151 | if u.startswith('_'): |
| 2152 | continue |
| 2153 | rb = tkinter.Radiobutton(self, text=u, variable=self.units, value=u) |
| 2154 | rb.grid(row=3, column=col, padx=20, sticky=tkinter.E) |
| 2155 | col += 1 |
| 2156 | |
| 2157 | self.d = LabeledEntry(self, "Duration", validate="focusout", validatecmd=self.validate) |
| 2158 | self.d.set(DragDialog.DEFAULT_DURATION) |
| 2159 | self.d.grid(row=4, column=1, columnspan=3, pady=5) |
| 2160 | |
| 2161 | self.s = LabeledEntry(self, "Steps", validate="focusout", validatecmd=self.validate) |
| 2162 | self.s.set(DragDialog.DEFAULT_STEPS) |
| 2163 | self.s.grid(row=5, column=1, columnspan=2, pady=5) |
| 2164 | |
| 2165 | self.buttonBox() |
| 2166 | |
| 2167 | def buttonBox(self): |
| 2168 | # add standard button box. override if you don't want the |
nothing calls this directly
no test coverage detected