summaryrefslogtreecommitdiffstats
path: root/qml/helpers.py
blob: f777f0411baee793dcff0153bc052b5c059a16e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -*- coding: utf-8 -*-

import gettext
import rpm

def get_desktop_name(x):
  return {
    '01plasma':'KDE Plasma',
    '02GNOME':'Gnome',
    'gnome': 'Gnome Wayland',
    'gnome-xorg': 'Gnome X.org',
    'LXDE':'LXDE',
    'MATE':'Mate',
    'Cinnamon':'Cinnamon',
    '23E17':'Enlightenment',
    '07IceWM':'IceWM',
    '26Openbox':'Openbox',
    '03WindowMaker':'WindowMaker',
    '09Fvwm2':'Fvwm2',
  }.get(x,'Other')

def get_desktop_name2(x):
  return {
      'KDE':'KDE Plasma',
      'XFCE':'Xfce',
      'LXQt':'LXQt',
      'MATE':'Mate',
      'GNOME':'Gnome',
      'X-Cinnamon':'Cinnamon',
    }.get(x,'unknown')
  

def is_installed(name):
    mi = rpm.TransactionSet().dbMatch('name', name)
    release = ""
    for h in mi:
        release = (h['release']).decode("utf-8")
    if release.endswith("tainted"):
        repo = 'tainted'
    elif release.endswith("nonfree"):
        repo = 'nonfree'
    else:
        repo = '' 
    return release != "", repo