Exemplo n.º 1
0
 def load_builder_file(cls, path_parts, root=None, domain=''):
     _id = "/".join(path_parts)
     if _id in _builders:
         return _builders[_id]
     buildername = pan_app.get_abs_data_filename(path_parts)
     builder = Builder()
     builder.add_from_file(buildername)
     builder.set_translation_domain(domain)
     _builders[_id] = builder
     return builder
Exemplo n.º 2
0
 def load_builder_file(cls, path_parts, root=None, domain=''):
     _id = "/".join(path_parts)
     if _id in _builders:
         return _builders[_id]
     buildername = pan_app.get_abs_data_filename(path_parts)
     builder = Builder()
     builder.add_from_file(buildername)
     builder.set_translation_domain(domain)
     _builders[_id] = builder
     return builder
Exemplo n.º 3
0
 def load_builder_file(cls, path_parts, root=None, domain=''):
     buildername = pan_app.get_abs_data_filename(path_parts)
     if os.name == 'nt' and getattr(sys, 'frozen', False):
         try:
             basedirs = [os.getcwd()]
             # FIXME
             #glade.bindtextdomain(domain, pan_app.get_abs_data_filename('locale', basedirs=basedirs))
         except Exception:
             logging.exception('bindtextdomain()')
     builder = Builder()
     builder.add_from_file(buildername)
     builder.set_translation_domain(domain)
     return buildername, builder
Exemplo n.º 4
0
    class XML(object):
        def __init__(self, fname, root=None, domain="", typedict={}):
            self.builder = Builder()
            if domain:
                self.builder.set_translation_domain(domain)
            conv = GtkBuilderConverter(root=root, skip_windows=False)
            conv.parse_file(fname)
            cwd = os.getcwd()
            os.chdir(os.path.dirname(fname))
            xml = conv.to_xml()
            self.builder.add_from_string(xml, len(xml))
            os.chdir(cwd)

        def signal_connect(self, handler_name, func):
            self.builder.connect(handler_name, func)

        def signal_autoconnect(self, dict):
            self.builder.connect_signals(dict)

        def get_widget(self, name):
            obj = self.builder.get_object(name)
            if isinstance(obj, Action):
                obj = obj.get_proxies()[0]
            return obj
Exemplo n.º 5
0
    class XML(object):
        def __init__(self, fname, root=None, domain="", typedict={}):
            self.builder = Builder()
            if domain:
                self.builder.set_translation_domain(domain)
            conv = GtkBuilderConverter(root=root, skip_windows=False)
            conv.parse_file(fname)
            cwd = os.getcwd()
            os.chdir(os.path.dirname(fname))
            xml = conv.to_xml()
            self.builder.add_from_string(xml, len(xml))
            os.chdir(cwd)

        def signal_connect(self, handler_name, func):
            self.builder.connect(handler_name, func)

        def signal_autoconnect(self, dict):
            self.builder.connect_signals(dict)

        def get_widget(self, name):
            obj = self.builder.get_object(name)
            if isinstance(obj, Action):
                obj = obj.get_proxies()[0]
            return obj