| OLD | NEW |
| 1 # Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE). | 1 # Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE). |
| 2 # http://www.logilab.fr/ -- mailto:contact@logilab.fr | 2 # http://www.logilab.fr/ -- mailto:contact@logilab.fr |
| 3 # | 3 # |
| 4 # This program is free software; you can redistribute it and/or modify it under | 4 # This program is free software; you can redistribute it and/or modify it under |
| 5 # the terms of the GNU General Public License as published by the Free Software | 5 # the terms of the GNU General Public License as published by the Free Software |
| 6 # Foundation; either version 2 of the License, or (at your option) any later | 6 # Foundation; either version 2 of the License, or (at your option) any later |
| 7 # version. | 7 # version. |
| 8 # | 8 # |
| 9 # This program is distributed in the hope that it will be useful, but WITHOUT | 9 # This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 11 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details | 11 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details |
| 12 # | 12 # |
| 13 # You should have received a copy of the GNU General Public License along with | 13 # You should have received a copy of the GNU General Public License along with |
| 14 # this program; if not, write to the Free Software Foundation, Inc., | 14 # this program; if not, write to the Free Software Foundation, Inc., |
| 15 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 15 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 16 """Tkinker gui for pylint""" | 16 """Tkinker gui for pylint""" |
| 17 from __future__ import print_function | 17 from __future__ import print_function |
| 18 | 18 |
| 19 import os | 19 import os |
| 20 import sys | 20 import sys |
| 21 import re | 21 import re |
| 22 from threading import Thread | 22 from threading import Thread |
| 23 | 23 |
| 24 import six | 24 import six |
| 25 | 25 |
| 26 from six.moves.tkinter import ( | 26 from six.moves.tkinter import ( |
| 27 Tk, Frame, Listbox, Entry, Label, Button, Scrollbar, | 27 Tk, Frame, Listbox, Entry, Label, Button, Scrollbar, |
| 28 Checkbutton, Radiobutton, IntVar, StringVar, | 28 Checkbutton, Radiobutton, IntVar, StringVar, PanedWindow, |
| 29 TOP, LEFT, RIGHT, BOTTOM, END, X, Y, BOTH, SUNKEN, W, | 29 TOP, LEFT, RIGHT, BOTTOM, END, X, Y, BOTH, SUNKEN, W, |
| 30 HORIZONTAL, DISABLED, NORMAL, W, | 30 HORIZONTAL, DISABLED, NORMAL, W, |
| 31 ) | 31 ) |
| 32 from six.moves.tkinter_tkfiledialog import ( | 32 from six.moves.tkinter_tkfiledialog import ( |
| 33 askopenfilename, askdirectory, | 33 askopenfilename, askdirectory, |
| 34 ) | 34 ) |
| 35 | 35 |
| 36 import pylint.lint | 36 import pylint.lint |
| 37 from pylint.reporters.guireporter import GUIReporter | 37 from pylint.reporters.guireporter import GUIReporter |
| 38 | 38 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 self.warning_box = None | 143 self.warning_box = None |
| 144 self.error_box = None | 144 self.error_box = None |
| 145 self.fatal_box = None | 145 self.fatal_box = None |
| 146 self.txtModule = None | 146 self.txtModule = None |
| 147 self.status = None | 147 self.status = None |
| 148 self.msg_type_dict = None | 148 self.msg_type_dict = None |
| 149 self.init_gui() | 149 self.init_gui() |
| 150 | 150 |
| 151 def init_gui(self): | 151 def init_gui(self): |
| 152 """init helper""" | 152 """init helper""" |
| 153 |
| 154 window = PanedWindow(self.root, orient="vertical") |
| 155 window.pack(side=TOP, fill=BOTH, expand=True) |
| 156 |
| 157 top_pane = Frame(window) |
| 158 window.add(top_pane) |
| 159 mid_pane = Frame(window) |
| 160 window.add(mid_pane) |
| 161 bottom_pane = Frame(window) |
| 162 window.add(bottom_pane) |
| 163 |
| 153 #setting up frames | 164 #setting up frames |
| 154 top_frame = Frame(self.root) | 165 top_frame = Frame(top_pane) |
| 155 mid_frame = Frame(self.root) | 166 mid_frame = Frame(top_pane) |
| 156 radio_frame = Frame(self.root) | 167 history_frame = Frame(top_pane) |
| 157 res_frame = Frame(self.root) | 168 radio_frame = Frame(mid_pane) |
| 158 msg_frame = Frame(self.root) | 169 rating_frame = Frame(mid_pane) |
| 159 check_frame = Frame(self.root) | 170 res_frame = Frame(mid_pane) |
| 160 history_frame = Frame(self.root) | 171 check_frame = Frame(bottom_pane) |
| 161 btn_frame = Frame(self.root) | 172 msg_frame = Frame(bottom_pane) |
| 162 rating_frame = Frame(self.root) | 173 btn_frame = Frame(bottom_pane) |
| 163 top_frame.pack(side=TOP, fill=X) | 174 top_frame.pack(side=TOP, fill=X) |
| 164 mid_frame.pack(side=TOP, fill=X) | 175 mid_frame.pack(side=TOP, fill=X) |
| 165 history_frame.pack(side=TOP, fill=BOTH, expand=True) | 176 history_frame.pack(side=TOP, fill=BOTH, expand=True) |
| 166 radio_frame.pack(side=TOP, fill=BOTH, expand=True) | 177 radio_frame.pack(side=TOP, fill=X) |
| 167 rating_frame.pack(side=TOP, fill=BOTH, expand=True) | 178 rating_frame.pack(side=TOP, fill=X) |
| 168 res_frame.pack(side=TOP, fill=BOTH, expand=True) | 179 res_frame.pack(side=TOP, fill=BOTH, expand=True) |
| 169 check_frame.pack(side=TOP, fill=BOTH, expand=True) | 180 check_frame.pack(side=TOP, fill=X) |
| 170 msg_frame.pack(side=TOP, fill=BOTH, expand=True) | 181 msg_frame.pack(side=TOP, fill=BOTH, expand=True) |
| 171 btn_frame.pack(side=TOP, fill=X) | 182 btn_frame.pack(side=TOP, fill=X) |
| 172 | 183 |
| 173 # Binding F5 application-wide to run lint | 184 # Binding F5 application-wide to run lint |
| 174 self.root.bind('<F5>', self.run_lint) | 185 self.root.bind('<F5>', self.run_lint) |
| 175 | 186 |
| 176 #Message ListBox | 187 #Message ListBox |
| 177 rightscrollbar = Scrollbar(msg_frame) | 188 rightscrollbar = Scrollbar(msg_frame) |
| 178 rightscrollbar.pack(side=RIGHT, fill=Y) | 189 rightscrollbar.pack(side=RIGHT, fill=Y) |
| 179 bottomscrollbar = Scrollbar(msg_frame, orient=HORIZONTAL) | 190 bottomscrollbar = Scrollbar(msg_frame, orient=HORIZONTAL) |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 """launch pylint gui from args""" | 522 """launch pylint gui from args""" |
| 512 if args: | 523 if args: |
| 513 print('USAGE: pylint-gui\n launch a simple pylint gui using Tk') | 524 print('USAGE: pylint-gui\n launch a simple pylint gui using Tk') |
| 514 sys.exit(1) | 525 sys.exit(1) |
| 515 gui = LintGui() | 526 gui = LintGui() |
| 516 gui.mainloop() | 527 gui.mainloop() |
| 517 sys.exit(0) | 528 sys.exit(0) |
| 518 | 529 |
| 519 if __name__ == '__main__': | 530 if __name__ == '__main__': |
| 520 Run(sys.argv[1:]) | 531 Run(sys.argv[1:]) |
| OLD | NEW |