summaryrefslogtreecommitdiffstats
path: root/usr/lib/mageiawelcome/helpers.py
blob: 027da77e0d8818843facc9d0a4f1682bde65b295 (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
# -*- coding: utf-8 -*-


import csv
import os


def get_listapp():
  listapp = ''
  with open("apps.csv", 'rb') as f:
      mycsv = csv.reader(f,delimiter='|')
      mycsv.next()
      for r in mycsv:
	if (r[6] == 'false'):
	  start_btn = ""
	else:
	  start_btn = "<button class='cmd small pill green' data-run='"+ r[6] + "'><i class='icon-ok-sign'> </i> start</button>" 
	if (r[7] != ''):
	  label = "<span class='label red'>" + r[7] + "</span>"
	else:
	  label = ""  
	if ( not os.path.isfile(r[5])):# DO ZAINSTALOWANIA
	  listapp += "<li class='" + r[3] +"' id='" + r[0] + "'><img class=icon src=img/" + r[0] + ".png /> \
<h6>" + r[2] + "</h6><p class=description>" + r[4] + "</p>" + start_btn  + label + "<button class='inst small pill' data-rpm='" + r[1] + "'><i class='icon-circle-arrow-down'> </i> install</button></li>"
	else: # JEST ZAINSTALOWANY
	  listapp += "<li class='urpme " + r[3] +"' id='" + r[0] + "'><img class=icon src=img/" + r[0] + ".png /> \
<h6>" + r[2] + "</h6><p class=description>" + r[4] + "</p>" + start_btn + label + "<button class='uninst small pill red' data-rpm='" + r[1] + "'><i class='icon-minus-sign'> </i> remove</button></li>"
  return listapp