[Netpopup-devel] netpopup/src mainwindow.py, 1.4, 1.5 msglist.py, 1.2, 1.3
Brought to you by:
irfanhamid
|
From: Irfan H. <irf...@us...> - 2007-10-21 02:44:20
|
Update of /cvsroot/netpopup/netpopup/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27782 Modified Files: mainwindow.py msglist.py Log Message: Added new widgets to handle status messages (message source and message # x/y is now displayed) Added get_len() and get_pos() methods to MsgList class Index: msglist.py =================================================================== RCS file: /cvsroot/netpopup/netpopup/src/msglist.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** msglist.py 20 Oct 2007 02:08:40 -0000 1.2 --- msglist.py 21 Oct 2007 02:44:21 -0000 1.3 *************** *** 17,20 **** --- 17,21 ---- # This class implements the functionality of a message list # + class MsgList: msg_list = []; *************** *** 52,53 **** --- 53,60 ---- if len(self.msg_list) > 0: del self.msg_list[old_pos] + + def get_pos(self): + return self.position; + + def get_len(self): + return len(self.msg_list); Index: mainwindow.py =================================================================== RCS file: /cvsroot/netpopup/netpopup/src/mainwindow.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mainwindow.py 20 Oct 2007 02:08:40 -0000 1.4 --- mainwindow.py 21 Oct 2007 02:44:20 -0000 1.5 *************** *** 61,69 **** self.incoming_textview.set_editable(False) self.sw = gtk.ScrolledWindow() self.sw.set_size_request(380, 250) self.sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) ! self.sw.add(self.incoming_textview) self.ctrl_box = gtk.HBox(False, 0) self.ctrl_box.pack_start(self.new_msg_btn, False, 0) --- 61,84 ---- self.incoming_textview.set_editable(False) + # These widgets show the src of the message and how many of how many messages # + self.incoming_src_name = gtk.TextView(None); + self.incoming_src_name.set_editable(False); + self.msg_counter = gtk.TextView(None); + self.msg_counter.set_editable(False); + # Setup a decent initial appearance of this field# + cnt_buffer = self.msg_counter.get_buffer(); + cnt_buffer.set_text("Message 0/0"); + + # Horizontal widget box that contains these two text fields # + self.status_box = gtk.HBox(False, 0); + self.status_box.pack_start(self.incoming_src_name, True, True, 0); + self.status_box.pack_start(self.msg_counter, True, True, 10); + self.sw = gtk.ScrolledWindow() self.sw.set_size_request(380, 250) self.sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) ! self.sw.add(self.incoming_textview) + # Horizontal widget box that contains all the buttons # self.ctrl_box = gtk.HBox(False, 0) self.ctrl_box.pack_start(self.new_msg_btn, False, 0) *************** *** 74,97 **** self.ctrl_box.pack_start(self.next_btn, False, 0) ! self.v_box = gtk.VBox(False, 0) ! self.v_box.pack_start(self.ctrl_box, False, 0) ! self.v_box.pack_start(self.sw, False, 0, 10) ! self.main_window.add(self.v_box) self.main_window.connect('destroy', self.destroy_handler, None) ! self.main_window.resize(400,300); ! self.quit_btn.show() ! self.new_msg_btn.show() ! self.del_msg_btn.show() ! self.change_name_btn.show() ! self.next_btn.show() ! self.prev_btn.show() ! self.ctrl_box.show() ! self.sw.show() ! self.incoming_textview.show() ! self.v_box.show() ! self.main_window.show() --- 89,117 ---- self.ctrl_box.pack_start(self.next_btn, False, 0) ! # Vertical widget box that contains the "control box", the status box and the text box # ! self.v_box = gtk.VBox(False, 0); ! self.v_box.pack_start(self.ctrl_box, True, True, 10); ! self.v_box.pack_start(self.status_box, True, True, 10); ! self.v_box.pack_start(self.sw, True, True, 10); ! self.main_window.add(self.v_box); self.main_window.connect('destroy', self.destroy_handler, None) ! self.main_window.resize(400,380); ! self.quit_btn.show(); ! self.new_msg_btn.show(); ! self.del_msg_btn.show(); ! self.change_name_btn.show(); ! self.next_btn.show(); ! self.prev_btn.show(); ! self.ctrl_box.show(); ! self.sw.show(); ! self.incoming_textview.show(); ! self.incoming_src_name.show(); ! self.msg_counter.show(); ! self.status_box.show(); ! self.v_box.show(); ! self.main_window.show(); *************** *** 210,226 **** def del_msg_handler(self, widget, data): self.msg_list.del_msg(); ! self.local_update_view() ! def local_update_view(self): (msg, src) = self.msg_list.get_current(); ! visible_buffer = self.incoming_textview.get_buffer(); ! visible_buffer.set_text(msg); while gtk.events_pending(): gtk.main_iteration(); def update_view(self): - (msg, src) = self.msg_list.get_current(); gtk.gdk.threads_enter(); ! visible_buffer = self.incoming_textview.get_buffer(); ! visible_buffer.set_text(msg); gtk.gdk.threads_leave(); --- 230,264 ---- def del_msg_handler(self, widget, data): self.msg_list.del_msg(); ! self.local_update_view(); ! def do_update_view(self): (msg, src) = self.msg_list.get_current(); ! ! # Set incoming text buffer to that retreived from the list # ! msg_buffer = self.incoming_textview.get_buffer(); ! msg_buffer.set_text(msg); ! ! # Set the src buffer to the retrieved source name # ! src_buffer = self.incoming_src_name.get_buffer(); ! src_buffer.set_text(src); ! ! # Set the message count buffer # ! msg_cnt_buffer = self.msg_counter.get_buffer(); ! list_len = self.msg_list.get_len(); ! if list_len == 0: ! pos = 0; ! else: ! pos = self.msg_list.get_pos() + 1; ! ! msg_cnt_buffer.set_text("Message " + `pos` + "/" + `list_len`); ! ! ! def local_update_view(self): ! self.do_update_view(); while gtk.events_pending(): gtk.main_iteration(); def update_view(self): gtk.gdk.threads_enter(); ! self.do_update_view(); gtk.gdk.threads_leave(); |