Changeset 29:315a5fdf099e
- Timestamp:
- 12/05/10 02:06:28 (5 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface.py
r26 r29 ˆà 20 20 self.is_started = Falseˆà 21 21 self.keys = dict()ˆà ˆà 22 self.draw()ˆà 22 23 def start(self):ˆà 23 24 if not self.is_started:ˆà òÀæ òÀæ ˆà 27 28 ˆà 28 29 def stop(self):ˆà 29 ˆà self.canvas.after_cancel(self.after_id)ˆàˆà 30 canvas.after_cancel(self.after_id)ˆà 30 31 self.is_started = Falseˆà 31 32 ˆà òÀæ òÀæ ˆà 40 41 passˆà 41 42 ˆà 42 ˆà def help(self):ˆà43 ˆà pass ˆà44 ˆà ˆà45 ˆà def close_help_window(self):ˆàˆà 43 def show_help_window(self):ˆà ˆà 44 passˆà ˆà 45 ˆà ˆà 46 def hide_help_window(self):ˆà 46 47 passˆà 47 48 ˆà òÀæ òÀæ ˆà 60 61 ˆà 61 62 def faster(self, speed_rate=1):ˆà 62 ˆà if self. speed> speed_rate:ˆàˆà 63 if self.delay > speed_rate:ˆà 63 64 self.delay = self.delay - speed_rateˆà 64 65 else:ˆà òÀæ òÀæ ˆà 156 157 ˆà 157 158 def to_top(self):# replace choosen state to topˆà 158 ˆà index = symbols.get(state_list.get("active").split()[1])ˆà159 ˆà state = states[index]ˆà160 ˆà del states[index]ˆà161 ˆà states.insert(0, state)ˆàˆà 159 index = automata.symbols.get(state_list.get("active").split()[1])ˆà ˆà 160 state = automata.states[index]ˆà ˆà 161 del automata.states[index]ˆà ˆà 162 automata.states.insert(0, state)ˆà 162 163 ˆà 163 164 def to_bottom(self):# replace choosen state to bottonˆà 164 ˆà index = symbols.get(state_list.get("active").split()[1])ˆà165 ˆà state = states[index]ˆà166 ˆà del states[index]ˆà167 ˆà states.append(state)ˆàˆà 165 index = automata.symbols.get(state_list.get("active").split()[1])ˆà ˆà 166 state = automata.states[index]ˆà ˆà 167 del automata.states[index]ˆà ˆà 168 automata.states.append(state)ˆà 168 169 ˆà 169 170 def upwards(self):ˆà 170 ˆà index = symbols.get(state_list.get("active").split()[1])ˆà171 ˆà state = states[index]ˆà172 ˆà del states[index]ˆà173 ˆà states.insert(index - 1, state)ˆàˆà 171 index = automata.symbols.get(state_list.get("active").split()[1])ˆà ˆà 172 state = automata.states[index]ˆà ˆà 173 del automata.states[index]ˆà ˆà 174 automata.states.insert(index - 1, state)ˆà 174 175 ˆà 175 176 def downwards(self):ˆà 176 ˆà index = symbols.get(state_list.get("active").split()[1])ˆà177 ˆà state = states[index]ˆà178 ˆà del states[index]ˆà179 ˆà states.insert(index + 1, state)ˆàˆà 177 index = automata.symbols.get(state_list.get("active").split()[1])ˆà ˆà 178 state = automata.states[index]ˆà ˆà 179 del automata.states[index]ˆà ˆà 180 automata.states.insert(index + 1, state)ˆà 180 181 ˆà 181 182 def delete_state(self):# delete choosen stateˆà 182 ˆà index = symbols.get(state_list.get("active").split()[1])ˆà183 ˆà del states[index]ˆàˆà 183 index = automata.symbols.get(state_list.get("active").split()[1])ˆà ˆà 184 del automata.states[index]ˆà 184 185 ˆà 185 186 def add(self):# add new stateˆà 186 187 passˆà ˆà 188 name = state_name.get()ˆà ˆà 189 symbol = state_sympob.get()ˆà ˆà 190 key = lower(state_key.get())ˆà ˆà 191 color = state_color.get()ˆà ˆà 192 nums = []ˆà ˆà 193 for i, value in enumerate(ckeckbox_nums):ˆà ˆà 194 if value:ˆà ˆà 195 nums.append(i)ˆà ˆà 196 if self.keys.has_key(key):ˆà ˆà 197 error.config(text="State with such key has already existed")ˆà ˆà 198 state_key.focus()ˆà ˆà 199 elif len(key) != 1:ˆà ˆà 200 error.config(text="Bad key for state")ˆà ˆà 201 state_key.focus()ˆà ˆà 202 elif automata.symbols.has_key(symbol):ˆà ˆà 203 error.config(text="State with such symbol has already existed")ˆà ˆà 204 state_symbol.focus()ˆà ˆà 205 elif len(symbol) != 1:ˆà ˆà 206 error.config(text="Bad symbol for state")ˆà ˆà 207 state_symbol.focus()ˆà ˆà 208 else:ˆà ˆà 209 state = State(name, symbol, color, nums)ˆà ˆà 210 automata.states.append(state)ˆà ˆà 211 automata.symbols(symbol) = len(automata.states) - 1ˆà ˆà 212 self.keys(key) = len(automata.states) - 1ˆà 187 213 ˆà 188 214 def change(self):# change chosen stateˆà
Note: See TracChangeset
for help on using the changeset viewer.