| Conditions | 1 |
| Total Lines | 60 |
| Code Lines | 31 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | class EventProcessingClass(): |
||
| 15 | def create_event_text(self): |
||
| 16 | """テキストイベントの設定 |
||
| 17 | |||
| 18 | ・テキストボックスにイベントを追加する。 |
||
| 19 | |||
| 20 | """ |
||
| 21 | # テキスト内でのスクロール時 |
||
| 22 | self.APP.text.bind('<<Scroll>>', self.APP.sfc.update_line_numbers) |
||
| 23 | self.APP.text.bind('<Up>', self.APP.sfc.update_line_numbers) |
||
| 24 | self.APP.text.bind('<Down>', self.APP.sfc.update_line_numbers) |
||
| 25 | self.APP.text.bind('<Left>', self.APP.sfc.update_line_numbers) |
||
| 26 | self.APP.text.bind('<Right>', self.APP.sfc.update_line_numbers) |
||
| 27 | # テキストの変更時 |
||
| 28 | self.APP.text.bind('<<Change>>', self.APP.sfc.change_setting) |
||
| 29 | # キー場押されたときの処理 |
||
| 30 | self.APP.text.bind("<Any-KeyPress>", self.APP.fpc.push_keys) |
||
| 31 | # ウィジェットのサイズが変わった際。行番号の描画を行う |
||
| 32 | self.APP.text.bind('<Configure>', self.APP.sfc.update_line_numbers) |
||
| 33 | # Tab押下時(インデント、又はコード補完) |
||
| 34 | self.APP.text.bind('<Tab>', self.APP.cpc.tab) |
||
| 35 | # ルビを振る |
||
| 36 | self.APP.text.bind('<Control-Key-r>', self.APP.pmc.ruby_huri) |
||
| 37 | # 開くダイアロクを表示する |
||
| 38 | self.APP.text.bind('<Control-Key-e>', self.APP.fmc.open_file) |
||
| 39 | # 保存ダイアロクを表示する |
||
| 40 | self.APP.text.bind('<Control-Key-w>', self.APP.fmc.save_file) |
||
| 41 | # 小説家になろうを開く |
||
| 42 | self.APP.text.bind( |
||
| 43 | '<Control-Key-u>', |
||
| 44 | self.APP.pmc.open_becoming_novelist_page |
||
| 45 | ) |
||
| 46 | # 検索ダイアログを開く |
||
| 47 | self.APP.text.bind('<Control-Key-f>', self.APP.fpc.find_dialog) |
||
| 48 | # 置換ダイアログを開く |
||
| 49 | self.APP.text.bind('<Control-Key-l>', self.APP.fpc.replacement_dialog) |
||
| 50 | # 上書き保存する |
||
| 51 | self.APP.text.bind('<Control-Key-s>', self.APP.fmc.overwrite_save_file) |
||
| 52 | # 新規作成する |
||
| 53 | self.APP.text.bind('<Control-Key-n>', self.APP.fmc.new_open) |
||
| 54 | # helpページを開く |
||
| 55 | self.APP.text.bind('<Control-Key-h>', self.APP.hmc.help) # helpページを開く |
||
| 56 | # Versionページを開く |
||
| 57 | self.APP.text.bind('<Control-Shift-Key-V>', self.APP.hmc.version) |
||
| 58 | # 文字数と行数をカウントすShift-る |
||
| 59 | self.APP.text.bind('<Control-Shift-Key-C>', self.APP.pmc.count_moji) |
||
| 60 | # redo処理 |
||
| 61 | self.APP.text.bind('<Control-Shift-Key-Z>', self.APP.emc.redo) |
||
| 62 | # uedo処理 |
||
| 63 | self.APP.text.bind('<Control-Key-z>', self.APP.emc.undo) |
||
| 64 | # フォントサイズの変更 |
||
| 65 | self.APP.text.bind('<Control-Shift-Key-F>', self.APP.pmc.font_dialog) |
||
| 66 | # 意味を検索 |
||
| 67 | self.APP.text.bind( |
||
| 68 | '<Control-Shift-Key-D>', |
||
| 69 | self.APP.pmc.find_wikipedia |
||
| 70 | ) |
||
| 71 | # 文章を読み上げ |
||
| 72 | self.APP.text.bind('<Control-Shift-Key-R>', self.APP.pmc.read_text) |
||
| 73 | # yahoo文字列解析 |
||
| 74 | self.APP.text.bind('<Control-Key-y>', self.APP.pmc.yahoo) |
||
| 75 | |||
| 213 |