Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

refactoring: move gtklib.StatusBar into new hgtk.statusbar module

Changeset e46f9a6cdc4e

Parent 136e346259ef

by Adrian Buehlmann

Changes to 9 files · Browse files at e46f9a6cdc4e Showing diff from parent 136e346259ef Diff from another changeset...

 
18
19
20
21
 
22
23
24
 
600
601
602
603
 
604
605
606
 
18
19
20
 
21
22
23
24
 
600
601
602
 
603
604
605
606
@@ -18,7 +18,7 @@
 from tortoisehg.util.hglib import *  from tortoisehg.util import shlib, hglib   -from tortoisehg.hgtk import gdialog, gtklib, hgcmd +from tortoisehg.hgtk import gdialog, gtklib, hgcmd, statusbar    class ChangeSet(gdialog.GDialog):   'GTK+ based dialog for displaying repository logs' @@ -600,7 +600,7 @@
  # add status bar for main app   vbox = gtk.VBox()   vbox.pack_start(self._hpaned, True, True) - self.stbar = gtklib.StatusBar() + self.stbar = statusbar.StatusBar()   self.stbar.show()   vbox.pack_start(gtk.HSeparator(), False, False)   vbox.pack_start(self.stbar, False, False)
 
22
23
24
25
 
26
27
28
 
113
114
115
116
 
117
118
119
 
22
23
24
 
25
26
27
28
 
113
114
115
 
116
117
118
119
@@ -22,7 +22,7 @@
 from tortoisehg.hgtk.logview.colormap import AnnotateColorSaturation  from tortoisehg.hgtk.logview.treeview import TreeView as LogTreeView  from tortoisehg.hgtk.logview import treemodel as LogTreeModelModule -from tortoisehg.hgtk import gtklib, gdialog, changeset +from tortoisehg.hgtk import gtklib, gdialog, changeset, statusbar    # Column indexes for grep  GCOL_REVID = 0 @@ -113,7 +113,7 @@
  modifier, gtk.ACCEL_VISIBLE)   notebook.connect('thg-new', self.new_notebook)   - self.stbar = gtklib.StatusBar() + self.stbar = statusbar.StatusBar()   self.stbar.sttext.set_property('use-markup', True)   vbox.pack_start(self.stbar, False, False, 2)   self.stop_button.set_sensitive(False)
 
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
 
75
76
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
79
80
@@ -75,64 +75,6 @@
  window.destroy()   return True   -class StatusBar(gtk.HBox): - def __init__(self, extra=None): - gtk.HBox.__init__(self) - self.pbar = gtk.ProgressBar() - self.sttext = gtk.Label("") - self.sttext.set_alignment(0, 0.5) - - self.pbox = gtk.HBox() - self.pbox.pack_start(gtk.VSeparator(), False, False) - self.pbox.pack_start(self.pbar, False, False) - - self.pack_start(self.sttext, padding=4) - if extra: - self.pack_end(extra, False, False) - self.right1_label = gtk.Label() - self.pack_end(self.right1_label, False, False, padding=20) - self.pack_end(self.pbox, False, False, padding=1) - self.pbox.set_child_visible(False) - self.right2_label = gtk.Label() - self.pack_end(self.right2_label, False, False, padding=5) - self.right3_label = gtk.Label() - self.pack_end(self.right3_label, False, False, padding=20) - self.show_all() - - def _pulse_timer(self, now=False): - self.pbar.pulse() - return True - - def begin(self, msg=_('Running'), timeout=100): - self.pbox.set_child_visible(True) - self.pbox.map() - self.set_status_text(msg) - self._timeout_event = gobject.timeout_add(timeout, self._pulse_timer) - - def end(self, msg='', unmap=True): - gobject.source_remove(self._timeout_event) - self.set_status_text(msg) - if unmap: - self.pbox.unmap() - else: - self.pbar.set_fraction(1.0) - - def set_status_text(self, msg): - self.sttext.set_text(str(msg)) - - def set_right1_text(self, msg): - self.right1_label.set_text(str(msg)) - - def set_right2_text(self, msg): - self.right2_label.set_text(str(msg)) - - def set_right3_text(self, msg): - self.right3_label.set_text(str(msg)) - - def set_pulse_step(self, val): - self.pbar.set_pulse_step(val) - -  class MessageDialog(gtk.Dialog):   button_map = {   gtk.BUTTONS_NONE: None,
 
18
19
20
21
 
22
23
24
 
205
206
207
208
 
209
210
211
 
18
19
20
 
21
22
23
24
 
205
206
207
 
208
209
210
211
@@ -18,7 +18,7 @@
 from tortoisehg.util.i18n import _  from tortoisehg.util import hglib, shlib, paths, thread2, settings   -from tortoisehg.hgtk import gtklib +from tortoisehg.hgtk import gtklib, statusbar    # This function and some key bits below borrowed ruthelessly from  # Peter Arrenbrecht <peter.arrenbrecht@gmail.com> @@ -205,7 +205,7 @@
  diffview.set_editable(False)     # status bar - self.stbar = gtklib.StatusBar() + self.stbar = statusbar.StatusBar()   mainvbox.pack_start(self.stbar, False, False, 2)     # register signal handlers
 
25
26
27
 
28
29
30
 
820
821
822
823
 
824
825
826
 
25
26
27
28
29
30
31
 
821
822
823
 
824
825
826
827
@@ -25,6 +25,7 @@
 from tortoisehg.hgtk import gdialog, gtklib, hgcmd, gorev, thgstrip  from tortoisehg.hgtk import backout, status, hgemail, tagadd, update, merge  from tortoisehg.hgtk import archive, changeset, thgconfig, thgmq, histdetails +from tortoisehg.hgtk import statusbar    def create_menu(label, callback):   menuitem = gtk.MenuItem(label, True) @@ -820,7 +821,7 @@
    def get_body(self):   self.gorev_dialog = None - self.stbar = gtklib.StatusBar() + self.stbar = statusbar.StatusBar()   self.limit = self.get_graphlimit(None)     # Allocate TreeView instance to use internally
 
18
19
20
21
 
22
23
24
 
89
90
91
92
 
93
94
95
 
18
19
20
 
21
22
23
24
 
89
90
91
 
92
93
94
95
@@ -18,7 +18,7 @@
 from tortoisehg.util.i18n import _  from tortoisehg.util import hglib, shlib, paths   -from tortoisehg.hgtk import gdialog, dialog, gtklib, hgthread +from tortoisehg.hgtk import gdialog, dialog, gtklib, hgthread, statusbar    class RecoveryDialog(gtk.Window):   def __init__(self): @@ -89,7 +89,7 @@
  foreground='#900000')   vbox.pack_start(scrolledwindow, True, True)   - self.stbar = gtklib.StatusBar() + self.stbar = statusbar.StatusBar()   vbox.pack_start(self.stbar, False, False, 2)     def _delete(self, widget, event):
 
21
22
23
24
 
25
26
27
 
421
422
423
424
 
425
426
427
 
21
22
23
 
24
25
26
27
 
421
422
423
 
424
425
426
427
@@ -21,7 +21,7 @@
 from tortoisehg.util.i18n import _  from tortoisehg.util import hglib, shlib, paths, hgshelve   -from tortoisehg.hgtk import dialog, gdialog, gtklib, guess, hgignore +from tortoisehg.hgtk import dialog, gdialog, gtklib, guess, hgignore, statusbar    # file model row enumerations  FM_CHECKED = 0 @@ -421,7 +421,7 @@
  self.tree_sel_changed(filesel, difftree, page_num)     def get_extras(self): - self.stbar = gtklib.StatusBar() + self.stbar = statusbar.StatusBar()   return self.stbar     def add_header_checkbox(self, col, post=None, pre=None, toggle=False):
Change 1 of 1 Show Entire File tortoisehg/​hgtk/​statusbar.py Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
@@ -0,0 +1,69 @@
+# statusbar.py - status bar widget for TortoiseHg +# +# Copyright 2008 TK Soh <teekaysoh@gmail.com> +# Copyright 2009 Steve Borho <steve@borho.org> +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2, incorporated herein by reference. + +import gtk +import gobject + +from tortoisehg.util.i18n import _ + +class StatusBar(gtk.HBox): + def __init__(self, extra=None): + gtk.HBox.__init__(self) + self.pbar = gtk.ProgressBar() + self.sttext = gtk.Label("") + self.sttext.set_alignment(0, 0.5) + + self.pbox = gtk.HBox() + self.pbox.pack_start(gtk.VSeparator(), False, False) + self.pbox.pack_start(self.pbar, False, False) + + self.pack_start(self.sttext, padding=4) + if extra: + self.pack_end(extra, False, False) + self.right1_label = gtk.Label() + self.pack_end(self.right1_label, False, False, padding=20) + self.pack_end(self.pbox, False, False, padding=1) + self.pbox.set_child_visible(False) + self.right2_label = gtk.Label() + self.pack_end(self.right2_label, False, False, padding=5) + self.right3_label = gtk.Label() + self.pack_end(self.right3_label, False, False, padding=20) + self.show_all() + + def _pulse_timer(self, now=False): + self.pbar.pulse() + return True + + def begin(self, msg=_('Running'), timeout=100): + self.pbox.set_child_visible(True) + self.pbox.map() + self.set_status_text(msg) + self._timeout_event = gobject.timeout_add(timeout, self._pulse_timer) + + def end(self, msg='', unmap=True): + gobject.source_remove(self._timeout_event) + self.set_status_text(msg) + if unmap: + self.pbox.unmap() + else: + self.pbar.set_fraction(1.0) + + def set_status_text(self, msg): + self.sttext.set_text(str(msg)) + + def set_right1_text(self, msg): + self.right1_label.set_text(str(msg)) + + def set_right2_text(self, msg): + self.right2_label.set_text(str(msg)) + + def set_right3_text(self, msg): + self.right3_label.set_text(str(msg)) + + def set_pulse_step(self, val): + self.pbar.set_pulse_step(val)
 
21
22
23
24
 
25
26
27
 
250
251
252
253
 
254
255
256
 
21
22
23
 
24
25
26
27
 
250
251
252
 
253
254
255
256
@@ -21,7 +21,7 @@
 from tortoisehg.util import hglib, settings, paths    from tortoisehg.hgtk import dialog, gtklib, hgthread, thgconfig -from tortoisehg.hgtk import thgshelve, hgemail, update +from tortoisehg.hgtk import thgshelve, hgemail, update, statusbar    class SynchDialog(gtk.Window):   def __init__(self, repos=[], pushmode=False): @@ -250,7 +250,7 @@
  basevbox.pack_start(scrolledwindow, True, True)     # statusbar - self.stbar = gtklib.StatusBar() + self.stbar = statusbar.StatusBar()   basevbox.pack_end(self.stbar, False, False, 2)     # support dropping of repos or bundle files