Style editor improvements
svn: r1324
This commit is contained in:
parent
ce77a02144
commit
49000e9695
@ -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"""
|
||||
@ -271,10 +271,10 @@ class StyleEditor:
|
||||
"""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)
|
||||
|
@ -748,7 +748,7 @@ class StyleSheetList:
|
||||
Saves the current StyleSheet definitions to the associated file.
|
||||
"""
|
||||
f = open(self.file,"w")
|
||||
f.write("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n")
|
||||
f.write("<?xml version=\"1.0\"?>\n")
|
||||
f.write('<stylelist>\n')
|
||||
for name in self.map.keys():
|
||||
if name == "default":
|
||||
|
@ -39,6 +39,7 @@ Preferences dialog under the Settings menu.</property>
|
||||
<property name="background_color">#e1e1dbdbc5c5</property>
|
||||
<property name="logo_background_color">#e1e1dcdcc5c5</property>
|
||||
<property name="textbox_color">#ffffffffffff</property>
|
||||
<property name="logo">gramps.png</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
@ -47,9 +48,9 @@ Preferences dialog under the Settings menu.</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Researcher Information</property>
|
||||
<property name="title_foreground">#53e00817c71b</property>
|
||||
<property name="background">#53e00817e818</property>
|
||||
<property name="logo_background">#d7a440c2e808</property>
|
||||
<property name="logo">gramps.xpm</property>
|
||||
<property name="background">#53e00817e118</property>
|
||||
<property name="logo_background">#d7a440c2e108</property>
|
||||
<property name="logo">gramps.png</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="druid-vbox1">
|
||||
@ -93,21 +94,21 @@ files, you may leave it blank.</property>
|
||||
<property name="n_rows">8</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">0</property>
|
||||
<property name="column_spacing">0</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">12</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label133">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Name</property>
|
||||
<property name="label" translatable="yes">Name:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -123,15 +124,15 @@ files, you may leave it blank.</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label134">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Address</property>
|
||||
<property name="label" translatable="yes">Address:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -147,15 +148,15 @@ files, you may leave it blank.</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label135">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">City</property>
|
||||
<property name="label" translatable="yes">City:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -171,15 +172,15 @@ files, you may leave it blank.</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label136">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">State/Province</property>
|
||||
<property name="label" translatable="yes">State/Province:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -195,15 +196,15 @@ files, you may leave it blank.</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label137">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Country</property>
|
||||
<property name="label" translatable="yes">Country:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -219,15 +220,15 @@ files, you may leave it blank.</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label138">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">email</property>
|
||||
<property name="label" translatable="yes">Email:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -243,15 +244,15 @@ files, you may leave it blank.</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label139">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">ZIP/Postal Code</property>
|
||||
<property name="label" translatable="yes">ZIP/Postal code:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -267,15 +268,15 @@ files, you may leave it blank.</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label140">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Phone</property>
|
||||
<property name="label" translatable="yes">Phone:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -306,8 +307,6 @@ files, you may leave it blank.</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="x_padding">3</property>
|
||||
<property name="y_padding">3</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -330,8 +329,6 @@ files, you may leave it blank.</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_padding">3</property>
|
||||
<property name="y_padding">3</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -354,8 +351,6 @@ files, you may leave it blank.</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_padding">3</property>
|
||||
<property name="y_padding">3</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -378,8 +373,6 @@ files, you may leave it blank.</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_padding">3</property>
|
||||
<property name="y_padding">3</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -402,8 +395,6 @@ files, you may leave it blank.</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_padding">3</property>
|
||||
<property name="y_padding">3</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -426,8 +417,6 @@ files, you may leave it blank.</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="x_padding">3</property>
|
||||
<property name="y_padding">3</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -450,8 +439,6 @@ files, you may leave it blank.</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="x_padding">3</property>
|
||||
<property name="y_padding">3</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -474,8 +461,6 @@ files, you may leave it blank.</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="x_padding">3</property>
|
||||
<property name="y_padding">3</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -503,8 +488,8 @@ files, you may leave it blank.</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Numerical Date Formats</property>
|
||||
<property name="title_foreground">#53e00817c71b</property>
|
||||
<property name="background">#53e00817e818</property>
|
||||
<property name="logo_background">#d7a440c2e808</property>
|
||||
<property name="background">#53e00817e118</property>
|
||||
<property name="logo_background">#d7a440c2e108</property>
|
||||
<property name="logo">gramps.xpm</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
@ -651,8 +636,8 @@ numerical dates</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Alternate Calendar Support</property>
|
||||
<property name="title_foreground">#53e00817c71b</property>
|
||||
<property name="background">#53e00817e818</property>
|
||||
<property name="logo_background">#d7a440c2e808</property>
|
||||
<property name="background">#53e00817e118</property>
|
||||
<property name="logo_background">#d7a440c2e108</property>
|
||||
<property name="logo">gramps.xpm</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
@ -748,8 +733,8 @@ more of these alternate calendars, enable alternate calendar support.</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">LDS Extensions</property>
|
||||
<property name="title_foreground">#53e00817c71b</property>
|
||||
<property name="background">#53e00817e818</property>
|
||||
<property name="logo_background">#d7a440c2e808</property>
|
||||
<property name="background">#53e00817e118</property>
|
||||
<property name="logo_background">#d7a440c2e108</property>
|
||||
<property name="logo">gramps.xpm</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
|
@ -199,6 +199,8 @@
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="default_width">450</property>
|
||||
<property name="default_height">350</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="icon">gramps.png</property>
|
||||
@ -259,7 +261,7 @@
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label247">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><span weight="bold" size="larger">Revert to an older revision</span></property>
|
||||
<property name="label" translatable="yes"><span weight="bold" size="larger">Select an older revision</span></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user