@@ -138,7 +138,6 @@ class Statusbar(gtk.Statusbar):
138
138
"""Contains feedback messages"""
139
139
def __init__ (self ):
140
140
gtk .Statusbar .__init__ (self )
141
-
142
141
self .context_id = self .get_context_id ('Statusbar' )
143
142
144
143
def message (self , s , n = 3 ):
@@ -276,23 +275,27 @@ def __init__(self, config, statusbar):
276
275
repl .Interaction .__init__ (self , config , statusbar )
277
276
278
277
def confirm (self , q ):
279
- dialog = gtk .MessageDialog (None , gtk .DIALOG_MODAL , gtk .MESSAGE_INFO , gtk .BUTTONS_YES_NO , q )
280
- response = True if dialog .run () == gtk .RESPONSE_YES else False
278
+ dialog = gtk .MessageDialog (None , gtk .DIALOG_MODAL , gtk .MESSAGE_INFO ,
279
+ gtk .BUTTONS_YES_NO , q )
280
+ response = dialog .run ()
281
281
dialog .destroy ()
282
- return response
282
+ return response == gtk . RESPONSE_YES
283
283
284
284
def file_prompt (self , s ):
285
285
chooser = gtk .FileChooserDialog (title = "File to save to" ,
286
286
action = gtk .FILE_CHOOSER_ACTION_SAVE ,
287
- buttons = (gtk .STOCK_CANCEL ,gtk .RESPONSE_CANCEL ,gtk .STOCK_OPEN ,gtk .RESPONSE_OK ))
287
+ buttons = (gtk .STOCK_CANCEL ,
288
+ gtk .RESPONSE_CANCEL ,
289
+ gtk .STOCK_OPEN ,
290
+ gtk .RESPONSE_OK ))
288
291
chooser .set_default_response (gtk .RESPONSE_OK )
289
292
chooser .set_current_name ('test.py' )
290
293
chooser .set_current_folder (os .path .expanduser ('~' ))
291
-
294
+
292
295
pyfilter = gtk .FileFilter ()
293
296
pyfilter .set_name ("Python files" )
294
297
pyfilter .add_pattern ("*.py" )
295
- chooser .add_filter (pyfilter )
298
+ chooser .add_filter (pyfilter )
296
299
297
300
allfilter = gtk .FileFilter ()
298
301
allfilter .set_name ("All files" )
@@ -618,7 +621,6 @@ def on_suggestion_selection_changed(self, selection, word):
618
621
self .get_cursor_iter ())
619
622
self .text_buffer .insert_at_cursor (word )
620
623
621
-
622
624
def do_paste (self , widget ):
623
625
clipboard = gtk .clipboard_get ()
624
626
paste_url = self .pastebin ()
@@ -635,7 +637,6 @@ def do_partial_paste(self, widget):
635
637
pass
636
638
else :
637
639
self .pastebin (self .text_buffer .get_text (bounds [0 ], bounds [1 ]))
638
-
639
640
640
641
def write (self , s ):
641
642
"""For overriding stdout defaults"""
@@ -654,8 +655,6 @@ def write(self, s):
654
655
self .echo (s )
655
656
self .s_hist .append (s .rstrip ())
656
657
657
-
658
-
659
658
def prompt (self , more ):
660
659
"""
661
660
Show the appropriate Python prompt.
@@ -792,20 +791,19 @@ def main(args=None):
792
791
793
792
filem = gtk .MenuItem ("File" )
794
793
filem .set_submenu (filemenu )
795
-
794
+
796
795
save = gtk .MenuItem ("Save to file" )
797
796
save .connect ("activate" , repl_widget .do_write2file )
798
797
filemenu .append (save )
799
798
800
-
801
799
pastebin = gtk .MenuItem ("Pastebin" )
802
800
pastebin .connect ("activate" , repl_widget .do_paste )
803
801
filemenu .append (pastebin )
804
802
805
803
pastebin_partial = gtk .MenuItem ("Pastebin selection" )
806
804
pastebin_partial .connect ("activate" , repl_widget .do_partial_paste )
807
805
filemenu .append (pastebin_partial )
808
-
806
+
809
807
exit = gtk .MenuItem ("Exit" )
810
808
exit .connect ("activate" , gtk .main_quit )
811
809
filemenu .append (exit )
@@ -816,7 +814,6 @@ def main(args=None):
816
814
817
815
container .pack_start (vbox , expand = False )
818
816
819
-
820
817
# read from config
821
818
sw = gtk .ScrolledWindow ()
822
819
sw .set_policy (gtk .POLICY_NEVER , gtk .POLICY_AUTOMATIC )
0 commit comments