manjaro-software-install-tools issueshttps://gitlab.manjaro.org/ste74/manjaro-software-install-tools/-/issues2018-08-14T22:36:48Zhttps://gitlab.manjaro.org/ste74/manjaro-software-install-tools/-/issues/1Using positional arguments with the GObject constructor has been deprecated2018-08-14T22:36:48ZPhilip MüllerUsing positional arguments with the GObject constructor has been deprecated```
phil@development ~/Arbeitsfläche $ manjaro-software-install-tool.py
(manjaro-software-install-tool.py:5531): dbind-WARNING **: 00:05:57.264: Couldn't connect to accessibility bus: Empty address ''
/usr/bin/manjaro-software-install-t...```
phil@development ~/Arbeitsfläche $ manjaro-software-install-tool.py
(manjaro-software-install-tool.py:5531): dbind-WARNING **: 00:05:57.264: Couldn't connect to accessibility bus: Empty address ''
/usr/bin/manjaro-software-install-tool.py:45: PyGTKDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "label" or use a class specific constructor. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations
self.installbutton = Gtk.Button("Install Selected Packages")
```https://gitlab.manjaro.org/ste74/manjaro-software-install-tools/-/issues/2too much repeat - for a general program2018-08-17T23:51:51Zpatricktoo much repeat - for a general programis best to create one data file (json for exemple)
make a loop to fill in the fields
exemple datas file
```
{
"internet":{
"caption":"Internet and ...",
"items":[
{ "name":"Chromium", "pkg":"chromium",...is best to create one data file (json for exemple)
make a loop to fill in the fields
exemple datas file
```
{
"internet":{
"caption":"Internet and ...",
"items":[
{ "name":"Chromium", "pkg":"chromium", "desc":"Open Source\nVersion of Google's Chrome Browser" },
{ "name":"Firefox", "pkg":"firefox", "desc":"Popular Mozilla Firefox Web Browser" },
{ "name":"Midori", "pkg":"midori" },
{ "name":"Falkon", "pkg":"falkon" },
{ "name":"Opera", "pkg":"opera" }
]
},
"media":{
"caption":"Média",
"items":[
{ "name":"Gimp", "pkg":"gimp", "icon":"gimp-ico.png" },
{ "name":"Vlc", "pkg":"vlc" }
]
},
"office":{
"caption":"Office",
"items":[
{ "name":"Livre Office (Fresh)", "pkg":"libre-office-fresh" },
{ "name":"Livre Office (Still)", "pkg":"libre-office-still" }
]
}
}
```
code consol test (not best code : I'm not a python coder)
```
import json
import glob
class Pkgs(object):
def __init__(self, fileName="softs.json"):
with open(fileName, 'r') as f:
self.pages = json.loads(f.read())
#print(json.dumps(self.pages, indent=2, sort_keys=False))
def setInstalled(self, obj):
obj['installed'] = False
#not use pacman for speed
if glob.glob("/var/lib/pacman/local/{}-[0-9]*".format(obj['pkg'])):
obj['installed'] = True
# add description if not exist in json
try:
i = obj['desc']
except KeyError:
obj['desc'] = "?" # or find desc in pacman -Si obj['pkg'] ?
return obj
def getIcon(self, obj):
try:
return obj['icon']
except KeyError:
return "{}.svg".format(obj['pkg']) #option in json
datas= Pkgs('./xfce/softs.json')
print ("\nset my page {}".format(datas.pages['internet']['caption']))
for p in datas.pages['internet']['items']:
#create field and btn
p = datas.setInstalled(p)
print(" ::{}: ({}{instal}) {desc}".format( p['name'], p['pkg'], instal=" installed" if p['installed'] == True else "", desc=p['desc']))
print ("\nset my page {}".format(datas.pages['media']['caption']))
for p in datas.pages['media']['items']:
p = datas.setInstalled(p)
print(" ::{}: ({}{instal}) {desc} {ico}".format( p['name'], p['pkg'], instal=" installed" if p['installed'] == True else "", desc=p['desc'], ico=datas.getIcon(p)))
```
my result:
```
set my page Internet and ...
::Chromium: (chromium installed) Open Source Version of Google's Chrome Browser
::Firefox: (firefox) Popular Mozilla Firefox Web Browser
::Midori: (midori) ?
::Falkon: (falkon installed) ?
::Opera: (opera) ?
set my page Média
set my page Média
::Gimp: (gimp installed) ? gimp-ico.png
::Vlc: (vlc installed) ? vlc.svg
```