def load_uh_widget(filename, style=None, center_widget=False): """Loads a pychan widget from an xml file and applies uh-specific modifications """ # load widget try: widget = loadXML(get_gui_files_map()[filename]) except (IOError, ValueError) as error: print u'PLEASE REPORT: invalid path {path} in translation! {error}'.format(path=filename, error=error) raise # translate widget = translate_widget(widget, filename) if style: widget.stylize(style) # format headline for w in widget.findChildren(): if w.name.startswith("headline") or w.name == "name": w.stylize('headline') elif w.name.startswith("uni_") or w.comment.startswith("uni_"): w.font = '16_black_unifont' if center_widget: widget.position_technique = "automatic" # "center:center" return widget
def load_uh_widget(filename, style=None, center_widget=False): """Loads a pychan widget from an xml file and applies uh-specific modifications """ # load widget try: widget = loadXML(get_gui_files_map()[filename]) except (IOError, ValueError) as error: print u'PLEASE REPORT: invalid path {path} in translation! {error}'.format(path=filename, error=error) raise # translate widget = translate_widget(widget, filename) if style: widget.stylize(style) # format headline for w in widget.findChildren(): if w.name.startswith("headline") or w.name == "name": w.stylize('headline') elif w.name.startswith("uni_") or w.comment.startswith("uni_"): w.font = 'unifont' if center_widget: widget.position_technique = "center:center" return widget
print 'Another file by the name %s already exists. Please use unique names!' % i return xml_files def load_uh_widget(filename, style=None, center_widget=False): """Loads a pychan widget from an xml file and applies uh-specific modifications """ # load widget try: widget = pychan.loadXML(get_gui_files_map()[filename]) except (IOError, ValueError), e: print 'PLEASE REPORT: invalid path', filename , 'in translation!', e raise # translate widget = translate_widget(widget, filename) if style: widget.stylize(style) # format headline for w in widget.findChildren(): if w.name.startswith("headline") or \ w.name == "name": w.stylize('headline') if center_widget: widget.position_technique = "automatic" # "center:center" return widget def get_res_icon(res): """Returns icons of a resource