alignment fixes - micah

This commit is contained in:
Marcos Pinto 2007-08-08 20:18:46 +00:00
parent b8aafa3448
commit 2f8f89cf18
2 changed files with 10 additions and 9 deletions

View File

@ -93,11 +93,11 @@ class TorrentPieces:
self.top_widget.show_all() self.top_widget.show_all()
columns = self.config.get("columns") columns = self.config.get("columns")
if columns is None: if columns is None:
columns = 15 columns = 13
font_size = self.config.get("font_size") font_size = self.config.get("font_size")
if font_size is None: if font_size is None:
font_size = 9 font_size = 7
self.tab_pieces = PiecesTabManager(self.manager, viewport, columns, font_size) self.tab_pieces = PiecesTabManager(self.manager, viewport, columns+1, font_size+1)
self.manager.connect_event(self.manager.constants['EVENT_FINISHED'], self.handle_event) self.manager.connect_event(self.manager.constants['EVENT_FINISHED'], self.handle_event)
def unload(self): def unload(self):
@ -106,16 +106,17 @@ class TorrentPieces:
self.tab_pieces.clear_pieces_store() self.tab_pieces.clear_pieces_store()
tab_page = self.parent_notebook.page_num(self.top_widget) tab_page = self.parent_notebook.page_num(self.top_widget)
self.parent_notebook.remove_page(tab_page) self.parent_notebook.remove_page(tab_page)
self.config.save(self.config_file)
def configure(self, window): def configure(self, window):
try: try:
self.combo_columns.set_active(self.config.get("columns")) self.combo_columns.set_active(self.config.get("columns"))
except: except:
self.combo_columns.set_active(15) self.combo_columns.set_active(13)
try: try:
self.combo_font_size.set_active(self.config.get("font_size")) self.combo_font_size.set_active(self.config.get("font_size"))
except: except:
self.combo_font_size.set_active(9) self.combo_font_size.set_active(7)
self.dialog.set_transient_for(window) self.dialog.set_transient_for(window)
self.dialog.show() self.dialog.show()
@ -155,8 +156,8 @@ class TorrentPieces:
self.combo_columns.get_active()) self.combo_columns.get_active())
self.config.set("font_size", self.config.set("font_size",
self.combo_font_size.get_active()) self.combo_font_size.get_active())
self.tab_pieces.set_columns(self.combo_columns.get_active()) self.tab_pieces.set_columns(self.combo_columns.get_active()+1)
self.tab_pieces.set_font_size(self.combo_font_size.get_active()) self.tab_pieces.set_font_size(self.combo_font_size.get_active()+1)
if needs_store_update: if needs_store_update:
self.tab_pieces.clear_pieces_store(clear_unique_id=False) self.tab_pieces.clear_pieces_store(clear_unique_id=False)
self.tab_pieces.prepare_pieces_store() self.tab_pieces.prepare_pieces_store()

View File

@ -146,14 +146,14 @@ class PiecesTabManager(object):
self.row += 1 self.row += 1
self.rows.append([]) self.rows.append([])
self.labels.append(gtk.Label()) self.labels.append(gtk.Label())
self.labels[row].set_alignment(0,0) self.labels[self.row].set_alignment(0,0)
self.vbox.pack_start(self.labels[self.row], expand=False) self.vbox.pack_start(self.labels[self.row], expand=False)
if row > row_prev: if row > row_prev:
self.row += 1 self.row += 1
row_list = {} row_list = {}
self.rows.append([]) self.rows.append([])
self.labels.append(gtk.Label()) self.labels.append(gtk.Label())
self.labels[row].set_alignment(0,0) self.labels[self.row].set_alignment(0,0)
self.vbox.pack_start(self.labels[self.row], expand=False) self.vbox.pack_start(self.labels[self.row], expand=False)
percentage = " 0% " percentage = " 0% "
self.pieces[main_index] = {'row':self.row, 'column':column} self.pieces[main_index] = {'row':self.row, 'column':column}