def test_get_installed_apps_and_icons(qtbot): apps = get_installed_applications() assert apps for app in apps: fpath = apps[app] icon = get_application_icon(fpath) assert icon assert osp.isdir(fpath) or osp.isfile(fpath)
def test_parse_linux_desktop_entry(): apps = get_installed_applications() for app in apps: fpath = apps[app] data = parse_linux_desktop_entry(fpath) assert data for key in ['name', 'icon_path', 'hidden', 'exec', 'type', 'fpath']: assert key in data assert fpath == data['fpath']
def setup(self, applications=None): """Load installed applications.""" QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) self.list.clear() if applications is None: apps = get_installed_applications() else: apps = applications for app in sorted(apps, key=lambda x: x.lower()): fpath = apps[app] icon = get_application_icon(fpath) item = QListWidgetItem(icon, app) item.setToolTip(fpath) item.fpath = fpath self.list.addItem(item) # FIXME: Use metrics self.list.setMinimumWidth(self.list.sizeHintForColumn(0) + 24) QApplication.restoreOverrideCursor() self._refresh()