Skip to content

Commit

Permalink
Fixed rhbz#838850, change locale list to language list
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesni committed Jul 19, 2012
1 parent 7e52e3a commit e8873f8
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions fontstweak/tool.py
Expand Up @@ -72,7 +72,7 @@ def __init__(self, parent):
lang = str(tokens[0]).split('.')[0].replace('_', '-')
self.langlist[lang] = string.join(tokens[3:], ' ')

def show_dialog(self, column):
def show_dialog(self, column, disable_default):
builder = Gtk.Builder()
builder.set_translation_domain(GETTEXT_PACKAGE)
path = os.path.dirname(os.path.realpath(__file__))
Expand All @@ -86,6 +86,8 @@ def show_dialog(self, column):
self.langStore = builder.get_object("lang_and_locale_list")

for l in self.langlist.keys():
if disable_default and l == '':
continue
iter = self.langStore.append()
self.langStore.set_value(iter, 0, l)
self.langStore.set_value(iter, 1, self.langlist[l])
Expand Down Expand Up @@ -147,7 +149,7 @@ def add_language(self, desc, lang):
return iter

def addlangClicked(self, *args):
response = self.languages.show_dialog(1)
response = self.languages.show_dialog(1, False)
if response != Gtk.ResponseType.CANCEL:
selection = self.languages.get_selection()
if selection != None:
Expand Down Expand Up @@ -182,7 +184,7 @@ def pango_addlanguage(self, desc, language):
return iteration

def pango_addlangClicked(self, *args):
response = self.languages.show_dialog(0)
response = self.languages.show_dialog(1, True)
if response != Gtk.ResponseType.CANCEL:
selection = self.languages.get_selection()
if selection != None:
Expand Down Expand Up @@ -234,7 +236,7 @@ def pango_removelangClicked(self, *args):
lang = model.get(iter, 1)[0]
self.pango_langlist.remove(iter)
self.removelang_button.set_sensitive(False)

def pango_applyClicked(self, *args):
pango_language = "export PANGO_LANGUAGE = "
languages = ""
Expand All @@ -253,7 +255,7 @@ def pango_applyClicked(self, *args):
def parse_content(self, path, pango_language):
find_pangolanguage = False
content = []

if os.path.exists(path):
config_file = open(path, 'r')
lines = config_file.readlines()
Expand All @@ -264,12 +266,12 @@ def parse_content(self, path, pango_language):
line = re.sub(r'(PANGO_LANGUAGE=).*$', r'\1%s'%pango_language, line)
find_pangolanguage = True
content.append(line)

if not find_pangolanguage:
content.append("#start: fonts-tweak-tool\n")
content.append("PANGO_LANGUAGE=%s\n"%pango_language)
content.append("#end: fonts-tweak-tool")

return content

def write_config(self, pango_language):
Expand Down Expand Up @@ -350,7 +352,7 @@ def closeClicked(self, *args):
self.applyClicked()
dialog.destroy()
Gtk.main_quit()

def pango_closeClicked(self, *args):
Gtk.main_quit()

Expand Down

0 comments on commit e8873f8

Please sign in to comment.