def _getTypeCombobox(self, additionalTypes=None): """ Initializes and returns a combination box displaying available property types. """ stringList = QStringList() if not additionalTypes is None: for typeName in additionalTypes: if not typeName in self._propertyTypeNames: stringList.append(typeName) for typeName in self._propertyTypeNames: stringList.append(typeName) typeComboBox = QComboTableItem(self.propertyTable, stringList) typeComboBox.setEditable(True) return typeComboBox
class EnvError(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) tweek_base_dir = getenv("TWEEK_BASE_DIR") if not tweek_base_dir: raise EnvError, "TWEEK_BASE_DIR environment variable not set" # Construct the path to the images that will be loaded by the GUI. image_dir = path.join(tweek_base_dir, "share", "tweek", "python", "images") # Set up PyQt. app = QApplication(sys.argv) # XXX: Is there a cleaner way to define a QStringList from Python? QMimeSourceFactory.defaultFactory().setFilePath(QStringList(image_dir)) # Load the user's preferences file. If it does not exist, it will be created. prefs = prefs.GlobalPreferences("/home/patrick/.tweekrc") prefs.parse() frame = tweekframe.TweekFrame() # XXX: This is a hack because I am lame. frame.globalPrefs = prefs frame.subjMgrList = [] frame.show() app.exec_loop()