def __str__(self): if self.disambig is None: disambig = "None" else: disambig = as_string(self.disambig, encode=False) return '_translate("%s", %s, %s)' % (i18n_context, as_string(self.string, encode=False), disambig)
def __str__(self): if self.disambig is None: disambig = "None" else: disambig = as_string(self.disambig, encode=False) return 'QtGui.QApplication.translate("%s", %s, %s, QtGui.QApplication.UnicodeUTF8)' % ( i18n_context, as_string(self.string, encode=False), disambig)
def __str__(self): if self.disambig is None: disambig = "None" else: disambig = as_string(self.disambig, encode=False) return 'QtGui.QApplication.translate("%s", %s, %s, QtGui.QApplication.UnicodeUTF8)' % ( i18n_context, as_string(self.string, encode=False), disambig, )
def __call__(self, *args): if self.function_name == "setProperty": str_args = (as_string(args[0], encode=False), as_string(args[1])) else: str_args = map(as_string, args) func_call = "%s.%s(%s)" % (self.proxy, self.function_name, ", ".join(str_args)) if self.flags & AS_ARGUMENT: self.proxy._uic_name = func_call return self.proxy else: needs_translation = False for arg in args: if isinstance(arg, i18n_string): needs_translation = True if needs_translation: i18n_print(func_call) else: write_code(func_call)
def __call__(self, *args): if self.function_name == 'setProperty': args = (as_string(args[0], encode=False), as_string(args[1])) else: args = map(as_string, args) func_call = "%s.%s(%s)" % (self.proxy, self.function_name, ", ".join(args)) if self.flags & AS_ARGUMENT: self.proxy._uic_name = func_call return self.proxy else: needs_translation = False for arg in args: if isinstance(arg, i18n_string): needs_translation = True if needs_translation: i18n_print(func_call) else: write_code(func_call)
def get_icon(self, iconset): """Return an icon described by the given iconset tag.""" # Handle a themed icon. theme = iconset.attrib.get('theme') if theme is not None: return self._object_factory.createQObject("QIcon.fromTheme", 'icon', (as_string(theme), ), is_attribute=False) # Handle an empty iconset property. if iconset.text is None: return None iset = _IconSet(iconset, self._base_dir) try: idx = self._cache.index(iset) except ValueError: idx = -1 if idx >= 0: # Return the icon from the cache. iset = self._cache[idx] else: # Follow uic's naming convention. name = 'icon' idx = len(self._cache) if idx > 0: name += str(idx) icon = self._object_factory.createQObject("QIcon", name, (), is_attribute=False) iset.set_icon(icon, self._qtgui_module) self._cache.append(iset) return iset.icon
def asString(self, s): return as_string(s)
def __str__(self): return "QtGui.QApplication.translate(\"%s\", %s, None, QtGui.QApplication.UnicodeUTF8)" % (i18n_context, as_string(self.string, encode=False))
def __str__(self): return "QtGui.QApplication.translate(\"%s\", %s, None, QtGui.QApplication.UnicodeUTF8)" % ( i18n_context, as_string(self.string, encode=False))