Skip to content

Commit

Permalink
Added Software Window (untested) see antoniovazquezblanco#13
Browse files Browse the repository at this point in the history
I added a window, definition files for various categories which can easily be installed

right now there are just 2 very basic categories, more to come... also I need to test...

Signed-off-by: Marius Messerschmidt <[email protected]>
  • Loading branch information
mame98 committed Sep 26, 2015
1 parent 9122c13 commit b9ae509
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ArchSetup
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ from Interface.Windows.HostnameWindow import HostnameWindow
from Interface.Windows.RootPassWindow import RootPassWindow
from Interface.Windows.AddUserWindow import AddUserWindow
from Interface.Windows.NetworkWindow import NetworkWindow
from Interface.Windows.SoftwareWindow import SoftwareWindow
from Interface.Windows.FilesystemWindow import FilesystemWindow
from Interface.Windows.LocaleWindow import LocaleWindow
from Interface.Windows.MainLocaleWindow import MainLocaleWindow
Expand Down Expand Up @@ -66,6 +67,7 @@ class ArchSetup:
self.windows.append(HostnameWindow(self.callback, self.setupconfig))
self.windows.append(RootPassWindow(self.callback, self.setupconfig))
self.windows.append(AddUserWindow(self.callback, self.setupconfig))
self.windows.append(SoftwareWindow(self.callback, self.setupconfig))
self.windows.append(FilesystemWindow(self.callback, self.setupconfig))
self.windows.append(DiskPartWindow(self.callback, self.setupconfig))
self.windows.append(PreInstallWindow(self.callback, self.setupconfig))
Expand Down
2 changes: 1 addition & 1 deletion Interface/Windows/InstallWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def event(self, event, opt=''):
self.refresh()
elif event == 'showed':
if self.has_runned == False:
for x in Pacstrap().run():
for x in Pacstrap().run(self.setupconfig):
self.status_label.settext(str(x))
self.refresh()
self.has_runned = True
Expand Down
52 changes: 52 additions & 0 deletions Interface/Windows/SoftwareWindow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of ArchSetup.
#
# ArchSetup is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ArchSetup is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ArchSetup. If not, see <http://www.gnu.org/licenses/>.

from SetupTools.Software import Software
from Interface.Windows.SetupWindow import SetupWindow
from Interface.Widgets.SpacerWidget import SpacerWidget
from Interface.Widgets.TextWidget import TextWidget
from Interface.Widgets.ScrollWidget import ScrollWidget
from Interface.Widgets.CheckWidget import CheckWidget

import gettext

class SoftwareWindow(SetupWindow):
def __init__(self, callback, setupconfig):
super().__init__()
self.callback = callback

# Init Translation
trans = gettext.translation("archsetup", "locale", fallback=True)
trans.install()

self.setupconfig = setupconfig
self.addwidget(TextWidget(1, 1, _('Please choose some additional software:'), 40))
software = Software()
items = software.listPackages()
self.addwidget(ScrollWidget(3, 1, 40, 20, CheckWidget(0, 0, 40, items, self.event), self.event))
self.addwidget(SpacerWidget(23, 1, 1))
self.setnextcallback(self.callback, 'next')
self.setprevcallback(callback, 'prev')

def event(self, event, opt=''):
if event == 'refresh':
self.refresh()
elif event == 'selection':
self.setupconfig.setsoftware(opt)
else:
super().event(event)
7 changes: 6 additions & 1 deletion SetupTools/Pacstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@
# along with ArchSetup. If not, see <http://www.gnu.org/licenses/>.

import subprocess
from SetupTools.Software import Software

class Pacstrap:
def __init__(self):
pass

def run(self):
def run(self, setupconfig):
p = subprocess.Popen(["pacstrap", "/mnt", "base", "base-devel"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
for line in p.stdout:
yield line.decode("utf-8")
software = Software()

for x in software.installPackages(setupconfig.software):
yield x
3 changes: 3 additions & 0 deletions SetupTools/SetupConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ def getlocales(self):

def setmainlocale(self, mainlocale):
self.mainlocale = mainlocale

def setsoftware(self, software):
self.software = software
35 changes: 35 additions & 0 deletions SetupTools/Software.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of ArchSetup.
#
# ArchSetup is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ArchSetup is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ArchSetup. If not, see <http://www.gnu.org/licenses/>.

from glob import glob
import subprocess

class Software:
def __init__(self):
pass

def listPackages(self):
return glob("software/*")

def installPackages(self, pkglist):
for pkg in pkglist:
with open(pkg) as f:
applications = " ".join(f.readlines()).replace('\n', '')
p = subprocess.Popen(["arch-chroot", "/mnt", "pacman", "--noconfirm", "-S"] + applications.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
for line in p.stdout:
yield line.decode("utf-8")
5 changes: 5 additions & 0 deletions software/GUI
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
xorg-server
xorg-xinit
xorg-utils
xorg-server-utils

3 changes: 3 additions & 0 deletions software/Office
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
libreoffice-fresh
evolution
chromium

0 comments on commit b9ae509

Please sign in to comment.