Default to window size from last session, added -n option to suppress. Apparently introduced some weird race condition that is causing start-up segfaults again, but it is very intermittent
This commit is contained in:
parent
39f5d216e4
commit
324bd13120
|
@ -22,6 +22,7 @@
|
||||||
<property name="urgency_hint">False</property>
|
<property name="urgency_hint">False</property>
|
||||||
<signal name="hide" handler="gtk_main_quit" last_modification_time="Fri, 09 Apr 2010 03:40:14 GMT"/>
|
<signal name="hide" handler="gtk_main_quit" last_modification_time="Fri, 09 Apr 2010 03:40:14 GMT"/>
|
||||||
<signal name="key_press_event" handler="global_key_press_handler" last_modification_time="Fri, 16 Apr 2010 15:35:22 GMT"/>
|
<signal name="key_press_event" handler="global_key_press_handler" last_modification_time="Fri, 16 Apr 2010 15:35:22 GMT"/>
|
||||||
|
<signal name="configure_event" handler="on_resize" last_modification_time="Tue, 18 May 2010 03:10:23 GMT"/>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="main_box">
|
<widget class="GtkVBox" id="main_box">
|
||||||
|
|
20
mytwitter.py
20
mytwitter.py
|
@ -13,7 +13,9 @@ class MyTwitter():
|
||||||
|
|
||||||
""" Display Tweets, post to twitter """
|
""" Display Tweets, post to twitter """
|
||||||
|
|
||||||
def __init__(self, config_file):
|
def __init__(self, config_file, resize):
|
||||||
|
self.resize = resize
|
||||||
|
|
||||||
config = ConfigParser.ConfigParser()
|
config = ConfigParser.ConfigParser()
|
||||||
config.read(os.path.expanduser(config_file))
|
config.read(os.path.expanduser(config_file))
|
||||||
|
|
||||||
|
@ -82,6 +84,7 @@ class MyTwitter():
|
||||||
self.widget_tree.signal_autoconnect(self)
|
self.widget_tree.signal_autoconnect(self)
|
||||||
|
|
||||||
# Get widgets from glade
|
# Get widgets from glade
|
||||||
|
self.window = self.widget_tree.get_widget('window')
|
||||||
self.tweet_notebook = self.widget_tree.get_widget('tweet_notebook')
|
self.tweet_notebook = self.widget_tree.get_widget('tweet_notebook')
|
||||||
self.view_menu = self.widget_tree.get_widget('view_menu')
|
self.view_menu = self.widget_tree.get_widget('view_menu')
|
||||||
self.update_entry = self.widget_tree.get_widget('update_entry')
|
self.update_entry = self.widget_tree.get_widget('update_entry')
|
||||||
|
@ -95,6 +98,10 @@ class MyTwitter():
|
||||||
|
|
||||||
|
|
||||||
def init_widgets(self):
|
def init_widgets(self):
|
||||||
|
# Set the main window size
|
||||||
|
if self.resize and self.db.has_key('width') and self.db.has_key('height'):
|
||||||
|
self.window.resize(self.db['width'], self.db['height'])
|
||||||
|
|
||||||
self.context_id = self.status_bar.get_context_id('message')
|
self.context_id = self.status_bar.get_context_id('message')
|
||||||
|
|
||||||
# Manual tweaks to the glade UI, to overcome its limitations
|
# Manual tweaks to the glade UI, to overcome its limitations
|
||||||
|
@ -454,15 +461,22 @@ class MyTwitter():
|
||||||
|
|
||||||
outer_menu_item.show()
|
outer_menu_item.show()
|
||||||
|
|
||||||
|
|
||||||
|
def on_resize(self, widget, event):
|
||||||
|
self.db['width'] = event.width
|
||||||
|
self.db['height'] = event.height
|
||||||
|
|
||||||
|
|
||||||
### end class MyTwitter
|
### end class MyTwitter
|
||||||
|
|
||||||
|
|
||||||
# main
|
# main
|
||||||
parser = optparse.OptionParser()
|
parser = optparse.OptionParser()
|
||||||
parser.add_option('-c' ,'--config', dest="filename", default="~/.mytwitter.conf")
|
parser.add_option('-c' ,'--config', dest="filename", default="~/.mytwitter.conf", help="read configuration from FILENAME instead of the default ~/.mytwitter.conf")
|
||||||
|
parser.add_option('-n' ,'--no-resize', dest="resize", action='store_false', default=True, help="use the default window size instead of the size from the last session")
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
my_twitter = MyTwitter(options.filename)
|
my_twitter = MyTwitter(options.filename, options.resize)
|
||||||
|
|
||||||
gtk.gdk.threads_init()
|
gtk.gdk.threads_init()
|
||||||
gtk.gdk.threads_enter()
|
gtk.gdk.threads_enter()
|
||||||
|
|
Reference in New Issue
Block a user