From 77679c01a76fcf9b2b2af2c837c155e031ebdec4 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 4 Mar 2003 05:48:36 +0000 Subject: [PATCH] Style editor improvements svn: r1324 --- src/StyleEditor.py | 48 +- src/TextDoc.py | 2 +- src/config.glade | 87 ++-- src/revision.glade | 4 +- src/styles.glade | 1186 ++++++++++++++++++++++---------------------- 5 files changed, 660 insertions(+), 667 deletions(-) diff --git a/src/StyleEditor.py b/src/StyleEditor.py index 4958ec8a7..f30c54832 100644 --- a/src/StyleEditor.py +++ b/src/StyleEditor.py @@ -30,6 +30,7 @@ __version__ = "$Revision$" # GNOME/GTK modules # #------------------------------------------------------------------------ +import gobject import gtk #------------------------------------------------------------------------ @@ -70,7 +71,8 @@ class StyleListDisplay: "on_edit_clicked" : self.on_edit_clicked }) - self.list = ListModel.ListModel(self.top.get_widget("list"),[('Style',-1,10)]) + self.list = ListModel.ListModel(self.top.get_widget("list"), + [('Style',-1,10)],) self.redraw() def redraw(self): @@ -126,7 +128,7 @@ class StyleListDisplay: StyleEditor(name,style,self) def on_delete_clicked(self,obj): - """Deletes teh selected style.""" + """Deletes the selected style.""" store,iter = self.list.selection.get_selected() if not iter: return @@ -153,7 +155,6 @@ class StyleEditor: self.style = TextDoc.StyleSheet(style) self.parent = parent self.top = gtk.glade.XML(const.stylesFile,"editor") - self.current_p = None self.top.signal_autoconnect({ "on_save_style_clicked" : self.on_save_style_clicked, @@ -161,25 +162,19 @@ class StyleEditor: }) self.window = self.top.get_widget("editor") - self.pnames = self.top.get_widget("name") + self.first = 1 + + titles = [(_('Paragraph'),0,130)] + self.plist = ListModel.ListModel(self.top.get_widget("ptree"),titles, + self.change_display) self.top.get_widget('color').connect('color-set',self.fg_color_set) self.top.get_widget('bgcolor').connect('color-set',self.bg_color_set) - self.top.get_widget("style_name").set_text(name) - myMenu = gtk.Menu() - first = 0 + for p_name in self.style.get_names(): - p = self.style.get_style(p_name) - if first == 0: - self.draw(p) - first = 1 - menuitem = gtk.MenuItem(p_name) - menuitem.set_data("o",p) - menuitem.connect("activate",self.change_display) - menuitem.show() - myMenu.append(menuitem) - self.pnames.set_menu(myMenu) + self.plist.add([p_name],self.style.get_style(p_name)) + self.plist.select_row(0) def draw(self,p): """Updates the display with the selected paragraph.""" @@ -211,14 +206,19 @@ class StyleEditor: self.top.get_widget("bborder").set_active(p.get_bottom_border()) self.fg_color = font.get_color() self.top.get_widget("color").set_i8(self.fg_color[0],self.fg_color[1],self.fg_color[2],0) + self.top.get_widget('color_code').set_text("#%02X%02X%02X" % self.fg_color) + self.bg_color = p.get_background_color() self.top.get_widget("bgcolor").set_i8(self.bg_color[0],self.bg_color[1],self.bg_color[2],0) + self.top.get_widget('bgcolor_code').set_text("#%02X%02X%02X" % self.bg_color) def bg_color_set(self,x,r,g,b,a): self.bg_color = (r >> 8, g >> 8, b >> 8) + self.top.get_widget('bgcolor_code').set_text("#%02X%02X%02X" % self.bg_color) def fg_color_set(self,x,r,g,b,a): self.fg_color = (r >> 8, g >> 8, b >> 8) + self.top.get_widget('color_code').set_text("#%02X%02X%02X" % self.fg_color) def save_paragraph(self,p): """Saves the current paragraph displayed on the dialog""" @@ -270,11 +270,11 @@ class StyleEditor: def change_display(self,obj): """Called when the paragraph selection has been changed. Saves the old paragraph, then draws the newly selected paragraph""" - - style = obj.get_data("o") - self.save_paragraph(self.current_p) - self.draw(style) - - - + objs = self.plist.get_selected_objects() + if self.first == 0: + self.save_paragraph(self.current_p) + else: + self.first = 0 + self.current_p = objs[0] + self.draw(self.current_p) diff --git a/src/TextDoc.py b/src/TextDoc.py index 92e37ae33..ab094d942 100644 --- a/src/TextDoc.py +++ b/src/TextDoc.py @@ -748,7 +748,7 @@ class StyleSheetList: Saves the current StyleSheet definitions to the associated file. """ f = open(self.file,"w") - f.write("\n") + f.write("\n") f.write('\n') for name in self.map.keys(): if name == "default": diff --git a/src/config.glade b/src/config.glade index f166d6e7a..2b886a85c 100644 --- a/src/config.glade +++ b/src/config.glade @@ -39,6 +39,7 @@ Preferences dialog under the Settings menu. #e1e1dbdbc5c5 #e1e1dcdcc5c5 #ffffffffffff + gramps.png @@ -47,9 +48,9 @@ Preferences dialog under the Settings menu. True Researcher Information #53e00817c71b - #53e00817e818 - #d7a440c2e808 - gramps.xpm + #53e00817e118 + #d7a440c2e108 + gramps.png @@ -93,21 +94,21 @@ files, you may leave it blank. 8 2 False - 0 - 0 + 6 + 12 True - Name + Name: False False GTK_JUSTIFY_CENTER False False - 1 + 0 0.5 - 5 + 0 0 @@ -123,15 +124,15 @@ files, you may leave it blank. True - Address + Address: False False GTK_JUSTIFY_CENTER False False - 1 + 0 0.5 - 5 + 0 0 @@ -147,15 +148,15 @@ files, you may leave it blank. True - City + City: False False GTK_JUSTIFY_CENTER False False - 1 + 0 0.5 - 5 + 0 0 @@ -171,15 +172,15 @@ files, you may leave it blank. True - State/Province + State/Province: False False GTK_JUSTIFY_CENTER False False - 1 + 0 0.5 - 5 + 0 0 @@ -195,15 +196,15 @@ files, you may leave it blank. True - Country + Country: False False GTK_JUSTIFY_CENTER False False - 1 + 0 0.5 - 5 + 0 0 @@ -219,15 +220,15 @@ files, you may leave it blank. True - email + Email: False False GTK_JUSTIFY_CENTER False False - 1 + 0 0.5 - 5 + 0 0 @@ -243,15 +244,15 @@ files, you may leave it blank. True - ZIP/Postal Code + ZIP/Postal code: False False GTK_JUSTIFY_CENTER False False - 1 + 0 0.5 - 5 + 0 0 @@ -267,15 +268,15 @@ files, you may leave it blank. True - Phone + Phone: False False GTK_JUSTIFY_CENTER False False - 1 + 0 0.5 - 5 + 0 0 @@ -306,8 +307,6 @@ files, you may leave it blank. 2 0 1 - 3 - 3 @@ -330,8 +329,6 @@ files, you may leave it blank. 2 1 2 - 3 - 3 @@ -354,8 +351,6 @@ files, you may leave it blank. 2 2 3 - 3 - 3 @@ -378,8 +373,6 @@ files, you may leave it blank. 2 3 4 - 3 - 3 @@ -402,8 +395,6 @@ files, you may leave it blank. 2 4 5 - 3 - 3 @@ -426,8 +417,6 @@ files, you may leave it blank. 2 5 6 - 3 - 3 @@ -450,8 +439,6 @@ files, you may leave it blank. 2 6 7 - 3 - 3 @@ -474,8 +461,6 @@ files, you may leave it blank. 2 7 8 - 3 - 3 @@ -503,8 +488,8 @@ files, you may leave it blank. True Numerical Date Formats #53e00817c71b - #53e00817e818 - #d7a440c2e808 + #53e00817e118 + #d7a440c2e108 gramps.xpm @@ -651,8 +636,8 @@ numerical dates True Alternate Calendar Support #53e00817c71b - #53e00817e818 - #d7a440c2e808 + #53e00817e118 + #d7a440c2e108 gramps.xpm @@ -748,8 +733,8 @@ more of these alternate calendars, enable alternate calendar support. True LDS Extensions #53e00817c71b - #53e00817e818 - #d7a440c2e808 + #53e00817e118 + #d7a440c2e108 gramps.xpm diff --git a/src/revision.glade b/src/revision.glade index dba0f98a3..37159a937 100644 --- a/src/revision.glade +++ b/src/revision.glade @@ -199,6 +199,8 @@ GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False + 450 + 350 True False gramps.png @@ -259,7 +261,7 @@ True - <span weight="bold" size="larger">Revert to an older revision</span> + <span weight="bold" size="larger">Select an older revision</span> False True GTK_JUSTIFY_CENTER diff --git a/src/styles.glade b/src/styles.glade index 6d6095a1a..c43f257f2 100644 --- a/src/styles.glade +++ b/src/styles.glade @@ -283,8 +283,8 @@ True - Style Name - False + Style _Name: + True False GTK_JUSTIFY_CENTER False @@ -293,6 +293,10 @@ 0.5 0 0 + style_name + + + 10 @@ -322,43 +326,11 @@ - - True - Paragraph Style - False - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 5 - 5 - - - 10 - True - True - + - - True - True - -1 - - - - True - - - - - 5 - True - True - + @@ -369,27 +341,59 @@ - + + 12 True - False - 0 + True - - 5 + True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + 130 + True + True + True + False + False + True + + + + + True + False + + + + + + True + True + True + False + GTK_POS_TOP + False + 2 + 2 + False + 12 True - 6 - 3 + 15 + 5 False - 0 - 0 + 6 + 12 @@ -406,10 +410,28 @@ 0 - 2 - 3 - 1 - 2 + 3 + 4 + 5 + 6 + fill + + + + + + + True + True + True + False + Pick a color + + + 1 + 2 + 8 + 9 fill @@ -425,102 +447,23 @@ GTK_UPDATE_ALWAYS False False - 1 0 100 1 10 10 + 0 0 100 1 10 10 1 - 2 - 1 - 2 - 5 - 5 - - - - - - - True - Size - False - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 5 - 5 - - - 0 - 1 - 1 - 2 - 5 - 5 + 3 + 5 + 6 fill - - - True - Color - False - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 5 - 5 - - - 0 - 1 - 2 - 3 - 5 - 5 - fill - - - - - - - True - Type Face - False - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0 - 5 - 5 - - - 0 - 1 - 0 - 1 - 5 - 5 - fill - fill - - - True True - Bold + _Bold True GTK_RELIEF_NORMAL False @@ -530,10 +473,8 @@ 1 3 - 3 - 4 - 5 - 5 + 11 + 12 fill @@ -543,7 +484,7 @@ True True - Italic + _Italic True GTK_RELIEF_NORMAL False @@ -553,10 +494,8 @@ 1 3 - 4 - 5 - 5 - 5 + 12 + 13 fill @@ -566,7 +505,7 @@ True True - Underline + _Underline True GTK_RELIEF_NORMAL False @@ -576,85 +515,81 @@ 1 3 - 5 - 6 - 5 - 5 + 13 + 14 fill - + True - False - 0 - - - - True - True - roman (Times) - True - GTK_RELIEF_NORMAL - False - False - True - - - 5 - False - False - - - - - - True - True - swiss (Arial, Helvetica) - True - GTK_RELIEF_NORMAL - False - False - True - roman - - - 0 - False - False - - + <b>Type Face</b> + False + True + GTK_JUSTIFY_CENTER + False + False + 0 + 0 + 0 + 0 - 1 - 3 + 0 + 4 0 1 fill - fill + - + True - True - True - False - Pick a color - + <b>Size</b> + False + True + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 - 1 - 3 - 2 - 3 - 5 - 5 - + 0 + 4 + 4 + 5 + fill + + + + + + + True + <b>Color</b> + False + True + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 4 + 7 + 8 + fill @@ -662,37 +597,107 @@ True - Options + <b>Options</b> False - False + True GTK_JUSTIFY_CENTER False False - 1 + 0 0 - 5 - 5 + 0 + 0 0 - 1 - 3 - 6 - 5 - 5 + 4 + 10 + 11 fill fill + + + + True + True + + False + False + GTK_JUSTIFY_LEFT + False + True + 0 + 0.5 + 0 + 0 + + + 2 + 3 + 8 + 9 + fill + + + + + + + True + True + _Roman (Times, serif) + True + GTK_RELIEF_NORMAL + False + False + True + + + 1 + 4 + 1 + 2 + fill + + + + + + + True + True + _Swiss (Arial, Helvetica, sans-serif) + True + GTK_RELIEF_NORMAL + False + False + True + roman + + + 1 + 4 + 2 + 3 + fill + + + + + False + True + - + True - Font Options + <b>Font Options</b> False - False + True GTK_JUSTIFY_LEFT False False @@ -702,53 +707,33 @@ 0 - label_item + tab - - - 0 - True - True - - - - - - 5 - True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN + 12 True - 6 - 3 + 13 + 6 False - 0 - 0 + 6 + 12 - + True - Background - False - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 5 - 5 + True + True + False + Pick a color - 0 - 1 - 1 - 2 + 1 + 2 + 4 + 5 fill @@ -757,22 +742,26 @@ True - Right Margin - False + R_ight: + True False GTK_JUSTIFY_CENTER False False - 1 + 0 0.5 - 5 - 5 + 0 + 0 + rmargin + + + - 0 - 1 - 2 - 3 + 1 + 2 + 7 + 8 fill @@ -781,22 +770,26 @@ True - Left Margin - False + L_eft: + True False GTK_JUSTIFY_CENTER False False - 1 + 0 0.5 - 5 - 5 + 0 + 0 + lmargin + + + - 0 - 1 - 3 - 4 + 1 + 2 + 8 + 9 fill @@ -805,32 +798,8 @@ True - Padding - False - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 5 - 5 - - - 0 - 1 - 4 - 5 - fill - - - - - - - True - cm - False + _Padding: + True False GTK_JUSTIFY_CENTER False @@ -839,40 +808,16 @@ 0.5 0 0 + pad + + + - 2 - 3 - 4 - 5 - 5 - 5 - fill - - - - - - - True - cm - False - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - - - 2 - 3 - 3 - 4 - 5 - 5 + 1 + 2 + 9 + 10 fill @@ -893,11 +838,58 @@ 0 - 2 - 3 - 2 - 3 - 5 + 4 + 5 + 7 + 8 + fill + + + + + + + True + cm + False + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + + + 4 + 5 + 8 + 9 + fill + + + + + + + True + cm + False + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + + + 4 + 5 + 9 + 10 fill @@ -916,12 +908,10 @@ False - 1 - 2 - 2 - 3 - 5 - 5 + 2 + 4 + 7 + 8 @@ -939,12 +929,10 @@ False - 1 - 2 - 3 - 4 - 5 - 5 + 2 + 4 + 8 + 9 @@ -961,13 +949,182 @@ * False + + 2 + 4 + 9 + 10 + + + + + + + True + True + _Left + True + GTK_RELIEF_NORMAL + False + False + True + 1 2 - 4 - 5 - 5 - 5 + 1 + 2 + fill + + + + + + + True + True + Le_ft + True + GTK_RELIEF_NORMAL + False + False + True + + + 1 + 2 + 12 + 13 + fill + + + + + + + True + True + _Right + True + GTK_RELIEF_NORMAL + False + False + True + lalign + + + 2 + 3 + 1 + 2 + fill + + + + + + + True + True + _Justify + True + GTK_RELIEF_NORMAL + False + False + True + lalign + + + 4 + 5 + 1 + 2 + fill + + + + + + + True + True + _Center + True + GTK_RELIEF_NORMAL + False + False + True + lalign + + + 3 + 4 + 1 + 2 + fill + + + + + + + True + True + Ri_ght + True + GTK_RELIEF_NORMAL + False + False + True + + + 2 + 3 + 12 + 13 + fill + + + + + + + True + True + _Bottom + True + GTK_RELIEF_NORMAL + False + False + True + + + 4 + 5 + 12 + 13 + fill + + + + + + + True + True + _Top + True + GTK_RELIEF_NORMAL + False + False + True + + + 3 + 4 + 12 + 13 + fill @@ -975,285 +1132,135 @@ True - Alignment + <b>Alignment</b> False - False + True GTK_JUSTIFY_CENTER False False - 1 + 0 0 - 5 - 5 + 0 + 0 0 - 1 + 6 0 1 - 5 - 5 fill + + + True + <b>Background</b> + False + True + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 6 + 3 + 4 + fill + + + + + + + True + <b>Margins</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 6 + 6 + 7 + fill + + + + True - Borders + <b>Borders</b> False - False + True GTK_JUSTIFY_CENTER False False - 1 + 0 0 - 5 - 5 + 0 + 0 0 - 1 - 5 - 6 - 5 - 5 + 6 + 11 + 12 fill + - - True - 2 - 2 - True - 0 - 0 - - - - True - True - left - True - GTK_RELIEF_NORMAL - False - False - True - - - 0 - 1 - 0 - 1 - - - - - - - True - True - right - True - GTK_RELIEF_NORMAL - False - False - True - lalign - - - 1 - 2 - 0 - 1 - - - - - - - True - True - center - True - GTK_RELIEF_NORMAL - False - False - True - lalign - - - 0 - 1 - 1 - 2 - - - - - - - True - True - justify - True - GTK_RELIEF_NORMAL - False - False - True - lalign - - - 1 - 2 - 1 - 2 - - - - - - 1 - 3 - 0 - 1 - fill - fill - - - - - - True - 2 - 2 - True - 0 - 0 - - - - True - True - left - True - GTK_RELIEF_NORMAL - False - False - True - - - 0 - 1 - 0 - 1 - - - - - - - True - True - top - True - GTK_RELIEF_NORMAL - False - False - True - - - 0 - 1 - 1 - 2 - - - - - - - True - True - right - True - GTK_RELIEF_NORMAL - False - False - True - - - 1 - 2 - 0 - 1 - - - - - - - True - True - bottom - True - GTK_RELIEF_NORMAL - False - False - True - - - 1 - 2 - 1 - 2 - - - - - - 1 - 3 - 5 - 6 - 5 - 5 - fill - fill - - - - - + True True - True - False - Pick a color - + + False + False + GTK_JUSTIFY_LEFT + False + True + 0 + 0.5 + 0 + 0 - 1 + 2 3 - 1 - 2 - 5 - 5 - + 4 + 5 + fill + + False + True + - + True - Paragraph Options + <b>Paragraph Options</b> False - False + True GTK_JUSTIFY_LEFT False False @@ -1263,14 +1270,13 @@ 0 - label_item + tab - 0 - True - True + True + True