|
|
@ -272,16 +272,41 @@ class Interface(object): |
|
|
|
|
|
|
|
|
|
|
|
self._systray = gtk.StatusIcon() |
|
|
|
self._systray = gtk.StatusIcon() |
|
|
|
self._systray.set_from_file(self._app_icon) |
|
|
|
self._systray.set_from_file(self._app_icon) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#where is systray_cb??? |
|
|
|
self._systray.connect('activate', self.systray_cb) |
|
|
|
self._systray.connect('activate', self.systray_cb) |
|
|
|
|
|
|
|
self._systray.connect('popup-menu', self.systray_popup) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# should set tooltip to msg text if that come? |
|
|
|
self._systray.set_tooltip('Mitter: Click to toggle window visibility.') |
|
|
|
self._systray.set_tooltip('Mitter: Click to toggle window visibility.') |
|
|
|
self._systray.set_visible(True) |
|
|
|
self._systray.set_visible(True) |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def systray_popup(self, icon, button, time): |
|
|
|
|
|
|
|
sys_popup = gtk.Menu() |
|
|
|
|
|
|
|
restore = gtk.MenuItem("Restore", False) |
|
|
|
|
|
|
|
exit = gtk.MenuItem("Exit", False) |
|
|
|
|
|
|
|
sys_popup.append(restore) |
|
|
|
|
|
|
|
sys_popup.append(exit) |
|
|
|
|
|
|
|
sys_popup.popup(None, None, None, 3, time) |
|
|
|
|
|
|
|
sys_popup.show_all() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def systray_cb(self, icon): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#why window location move down and down? |
|
|
|
|
|
|
|
if self._main_window.is_active(): |
|
|
|
|
|
|
|
self._main_window.hide() |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
self._main_window.show() |
|
|
|
|
|
|
|
|
|
|
|
def _create_main_window(self): |
|
|
|
def _create_main_window(self): |
|
|
|
"""Returns the object with the main window and the attached |
|
|
|
"""Returns the object with the main window and the attached |
|
|
|
widgets.""" |
|
|
|
widgets.""" |
|
|
|
main_window = gtk.Window(gtk.WINDOW_TOPLEVEL) |
|
|
|
main_window = gtk.Window(gtk.WINDOW_TOPLEVEL) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#where is this method? |
|
|
|
|
|
|
|
self._systray_setup() |
|
|
|
|
|
|
|
|
|
|
|
initial_width = int(self._options[self.NAMESPACE]['width']) |
|
|
|
initial_width = int(self._options[self.NAMESPACE]['width']) |
|
|
|
initial_height = int(self._options[self.NAMESPACE]['height']) |
|
|
|
initial_height = int(self._options[self.NAMESPACE]['height']) |
|
|
|
_log.debug('Initial size: %d x %d', initial_width, initial_height) |
|
|
|
_log.debug('Initial size: %d x %d', initial_width, initial_height) |
|
|
@ -291,7 +316,7 @@ class Interface(object): |
|
|
|
_log.debug('Initial position: %d x %d', initial_x, initial_y) |
|
|
|
_log.debug('Initial position: %d x %d', initial_x, initial_y) |
|
|
|
|
|
|
|
|
|
|
|
main_window.set_title('Mitter') |
|
|
|
main_window.set_title('Mitter') |
|
|
|
main_window.set_size_request(10, 10) # very small minimal size |
|
|
|
main_window.set_size_request(450, 300) # very small minimal size |
|
|
|
main_window.resize(initial_width, initial_height) |
|
|
|
main_window.resize(initial_width, initial_height) |
|
|
|
main_window.move(initial_x, initial_y) |
|
|
|
main_window.move(initial_x, initial_y) |
|
|
|
|
|
|
|
|
|
|
@ -483,7 +508,7 @@ class Interface(object): |
|
|
|
text_buffer = self._update_text.get_buffer() |
|
|
|
text_buffer = self._update_text.get_buffer() |
|
|
|
text_buffer.connect('changed', self._count_chars) |
|
|
|
text_buffer.connect('changed', self._count_chars) |
|
|
|
|
|
|
|
|
|
|
|
self._update_button = gtk.Button(stock=gtk.STOCK_ADD) |
|
|
|
self._update_button = gtk.Button(label = "(140)") |
|
|
|
self._update_button.connect('clicked', self._update_status) |
|
|
|
self._update_button.connect('clicked', self._update_status) |
|
|
|
self._update_button.set_property('sensitive', False) |
|
|
|
self._update_button.set_property('sensitive', False) |
|
|
|
|
|
|
|
|
|
|
@ -493,14 +518,14 @@ class Interface(object): |
|
|
|
update_box.pack_start(self._update_button, expand=False, fill=False, |
|
|
|
update_box.pack_start(self._update_button, expand=False, fill=False, |
|
|
|
padding=0) |
|
|
|
padding=0) |
|
|
|
|
|
|
|
|
|
|
|
info_box = gtk.HBox(False, 0) |
|
|
|
#info_box = gtk.HBox(False, 0) |
|
|
|
self._char_count = gtk.Label() |
|
|
|
#self._char_count = gtk.Label() |
|
|
|
self._char_count.set_text('(140)') |
|
|
|
#self._char_count.set_text('(140)') |
|
|
|
info_box.pack_start(gtk.Label('What are you doing?')) |
|
|
|
#info_box.pack_start(gtk.Label('What are you doing?')) |
|
|
|
info_box.pack_start(self._char_count) |
|
|
|
#info_box.pack_start(self._char_count) |
|
|
|
|
|
|
|
|
|
|
|
update_area = gtk.VBox(True, 0) |
|
|
|
update_area = gtk.VBox(True, 0) |
|
|
|
update_area.pack_start(info_box) |
|
|
|
#update_area.pack_start(info_box) |
|
|
|
update_area.pack_start(update_box) |
|
|
|
update_area.pack_start(update_box) |
|
|
|
|
|
|
|
|
|
|
|
return update_area |
|
|
|
return update_area |
|
|
@ -627,8 +652,9 @@ class Interface(object): |
|
|
|
text = _buffer_text(text_buffer) |
|
|
|
text = _buffer_text(text_buffer) |
|
|
|
count = len(text) |
|
|
|
count = len(text) |
|
|
|
|
|
|
|
|
|
|
|
self._char_count.set_text('(%d)' % (140 - count)) |
|
|
|
self._update_button.set_label('(%d)' % (140 - count)) |
|
|
|
self._update_sensitivity(not (count == 0)) |
|
|
|
self._update_sensitivity(not (count == 0)) |
|
|
|
|
|
|
|
|
|
|
|
return True |
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
def _update_status(self, widget): |
|
|
|
def _update_status(self, widget): |
|
|
|