summaryrefslogtreecommitdiffstats
path: root/qml/helpers.py
blob: 05fb4c9f0df11b323a0ffe97b8c4ee55edd255cc (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
45
46
47
48
# -*- coding: utf-8 -*-

import gettext
import rpm

gettext.install("mageiawelcome")

ts = rpm.TransactionSet()

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 = ts.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