Skip to content

Commit bcd0a74

Browse files
authored
Merge pull request #63 from Samuobe/dev
Features completed, now moving on to beta!
2 parents bc72680 + 89d9a1c commit bcd0a74

6 files changed

Lines changed: 213 additions & 11 deletions

File tree

PKGBUILD/PKGBUILD-dev

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Maintainer: Samuobe samuobe@ik.me
2+
3+
pkgname=arch-store-dev-git
4+
pkgver=2.0.1
5+
pkgrel=1
6+
pkgdesc="A graphical app for managing your programs with pacman, AUR, flatpak, and appimage"
7+
arch=('any')
8+
url="https://github.com/Samuobe/Arch-Store"
9+
license=('GPL3')
10+
depends=('python' 'python-pyqt6')
11+
makedepends=('git' 'python-setuptools')
12+
source=("git+$url.git#branch=dev")
13+
md5sums=('SKIP')
14+
15+
pkgver() {
16+
cd Arch-Store
17+
git describe --tags --always | sed 's/^v//;s/-/./g'
18+
}
19+
20+
package() {
21+
# Copia tutto il progetto in /usr/share/arch-store
22+
install -d "$pkgdir/usr/share/arch-store"
23+
cp -r "$srcdir/Arch-Store/"* "$pkgdir/usr/share/arch-store/"
24+
25+
# Crea la cartella dati globale con permessi corretti
26+
install -dm1777 "$pkgdir/var/lib/arch-store"
27+
28+
29+
# Crea un wrapper in /usr/bin
30+
install -Dm755 /dev/stdin "$pkgdir/usr/bin/arch-store" <<EOF
31+
#!/bin/sh
32+
exec python3 /usr/share/arch-store/main.py "\$@"
33+
EOF
34+
35+
# Icona
36+
install -Dm644 "$srcdir/Arch-Store/icon.png" "$pkgdir/usr/share/pixmaps/arch-store.png"
37+
38+
# File .desktop
39+
install -Dm644 "$srcdir/Arch-Store/arch-store.desktop" "$pkgdir/usr/share/applications/arch-store.desktop"
40+
41+
42+
#version type
43+
install -Dm644 /dev/null "$pkgdir/usr/share/arch-store/beta"
44+
45+
rm -f "$pkgdir/usr/share/arch-store/script"
46+
47+
48+
}
49+

install.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ echo "Welcome to the Arch-Store installation program!"
55
echo "What do you want to do?"
66
echo "1) Install/Update Arch-Store"
77
echo "2) Uninstall Arch-Store"
8-
read -p "Select an option [1/2]: " action
8+
read -p "Select an option [1/2/5]: " action
99

1010
if [[ "$action" == "1" ]]; then
1111
mkdir arch-store-install
@@ -43,6 +43,16 @@ elif [[ "$action" == "2" ]]; then
4343
sudo pacman -Rns arch-store
4444
sudo pacman -Rns arch-store-git
4545
echo "FINISHED!"
46+
elif [[ "$actions" == "5" ]]; then
47+
echo "Installing Arch-Store DEV branch..."
48+
wget https://raw.githubusercontent.com/samuobe/Arch-Store/main/PKGBUILD/PKGBUILD-dev
49+
mv PKGBUILD-dev PKGBUILD
50+
makepkg -si
51+
rm PKGBUILD
52+
echo "FINISHED!"
53+
54+
cd ..
55+
rm -rf arch-store-install
4656
fi
4757

4858

lpak/English.lpak

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,12 @@ last modified|Last modified
135135
popularity|Popularity
136136
votes|Votes
137137
outdated|Outdated
138+
Update ArchStore|Update ArchStore
139+
Select a version|Select a version
140+
Do you want to install the stable version?|Do you want to install the stable version?
141+
Do you want to open GitHub?|Do you want to open GitHub?
142+
It appears that you installed ArchStore from the script. Would you like to open GitHub to rerun the script?|It appears that you installed ArchStore from the script. Would you like to open GitHub to rerun the script?
143+
Script|Script
144+
Installated with|Installed whit
145+
updated, please restart|Updated, please restart ArchStore
146+
updated|Updated

lpak/Italiano.lpak

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,13 @@ keywords|Parole chiave
134134
last modified|Ultima modifica
135135
popularity|Popolarità
136136
votes|Voti
137-
outdated|Obsoleto
137+
outdated|Obsoleto
138+
Update ArchStore|Aggiorna ArchStore
139+
Select a version|Seleziona una versione
140+
Do you want to install the stable version?|Vuoi installare la versione stabile?
141+
Do you want to open GitHub?|Vuoi aprire GitHub?
142+
It appears that you installed ArchStore from the script. Would you like to open GitHub to rerun the script?|Sembra che tu abbia installato ArchStore dallo script, vuoi aprire GitHub per riscaricarlo?
143+
Script|Script
144+
Installated with|Installato con
145+
updated, please restart|Aggiornato, riavvia l'applicazione
146+
updated|Aggiornato

main.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from PyQt6.QtGui import QIcon
1111
from PyQt6.QtCore import QProcess
1212
import sys
13+
import glob
1314

1415
#PY files
1516
import appimages as archstoreAppimages
@@ -20,8 +21,7 @@
2021
from manage_installed_method import show_window as show_installed_method
2122

2223
#fast access variables
23-
avaible_languages= ["Chinese Simplified", "Deutsch", "English", "Español", "Euskera", "Français", "Italiano", "Lietuvių", "Norsk", "Polski", "Română", "Türkçe"]
24-
24+
arch_store_version = "beta_SETTINGS-UPDATE_1.0.0"
2525

2626
#Base variables
2727
install_pacman_packages=[]
@@ -52,6 +52,7 @@
5252
working_dir="/var/lib/arch-store"
5353
os.chdir(base_dir)
5454
user_name = getpass.getuser()
55+
avaible_languages_temp = glob.glob(f"{base_dir}/lpak/*.lpak")
5556

5657
#add anything global to global scope before using it global, also put defaults
5758
setting_repo_pacman="enable"
@@ -61,6 +62,17 @@
6162
language="English"
6263
AppImagesDir=f"{working_dir}/AppImages"
6364

65+
#####################
66+
###starting things###
67+
#####################
68+
69+
#Adjust languages name
70+
avaible_languages = []
71+
for language in avaible_languages_temp:
72+
avaible_languages.append(language.split("/")[-1].split(".")[0])
73+
avaible_languages.sort(key=str.lower)
74+
75+
6476
#Config data
6577
def load_config_data():
6678
def write_new_config_file():
@@ -100,7 +112,7 @@ def read_config_data():
100112
#END ALLERT
101113

102114
def open_setting():
103-
win = archstoreSettings.open_setting(language, working_dir, avaible_languages)
115+
win = archstoreSettings.open_setting(language, working_dir, avaible_languages, arch_store_version)
104116
win.exec()
105117
load_config_data()
106118

settings.py

Lines changed: 119 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
from show_allert import show_allert
66
import webbrowser
7+
from PyQt6.QtCore import QProcess
78
def load_config_data(working_dir, avaible_languages, language):
89
def write_new_config_file():
910
with open(f"{working_dir}/settings.conf", "w") as f:
@@ -35,9 +36,14 @@ def read_config_data():
3536
read_config_data()
3637

3738

38-
def open_setting(language, working_dir, avaible_languages):
39+
def open_setting(language, working_dir, avaible_languages, version):
3940
global pacman_status, aur_status, flatpak_status, aur_method, new_language, app_image_dir
4041
load_config_data(working_dir, avaible_languages, language)
42+
43+
if not os.path.isfile(working_dir+"/script"):
44+
script_installation_status = False
45+
else:
46+
script_installation_status = True
4147
#Edit repo
4248
def confirm_changes():
4349
global pacman_status, aur_status, flatpak_status, aur_method, new_language, app_image_dir, old_language
@@ -92,8 +98,7 @@ def change_aur_method(button, label):
9298
else:
9399
aur_method = "paru"
94100
label.setText(lpak.get("aur method", language)+": "+aur_method)
95-
96-
101+
97102
def setting_change_appimagedir(button):
98103
new_dir_temp = pq.QFileDialog.getExistingDirectory(settings_page, lpak.get("select a folder", language))
99104
response = pq.QMessageBox.question(settings_page,
@@ -109,6 +114,102 @@ def setting_change_appimagedir(button):
109114

110115
else:
111116
return
117+
118+
def update_arch_store():
119+
if script_installation_status == False:
120+
def after_operations():
121+
button_update_archStore.setText(lpak.get("updated", language))
122+
123+
def start_thread_operations(label, button):
124+
125+
126+
global proc
127+
128+
# Aggiorna subito la UI (thread principale)
129+
button.setDisabled(True)
130+
label.setText(lpak.get("install in progress", language))
131+
progress_bar.setRange(0, 0)
132+
operations_window.repaint()
133+
134+
proc = QProcess(operations_window)
135+
136+
def close_updates():
137+
operations_window.close()
138+
139+
140+
def on_finished(exitCode, exitStatus):
141+
global install_status
142+
install_status = False
143+
progress_bar.setRange(0, 1)
144+
button.setText(lpak.get("finished", language))
145+
label.setText(lpak.get("updated, please restart", language))
146+
try:
147+
button.pressed.disconnect()
148+
except TypeError:
149+
pass
150+
after_operations()
151+
button.setDisabled(False)
152+
button.clicked.connect(close_updates)
153+
operations_window.update()
154+
155+
def on_error(err):
156+
global install_status
157+
install_status = False
158+
progress_bar.setRange(0, 1)
159+
label.setText(f"{lpak.get('error', language)}: {err}")
160+
button.setDisabled(False)
161+
operations_window.update()
162+
163+
proc.finished.connect(on_finished)
164+
proc.errorOccurred.connect(on_error)
165+
166+
proc.start("pkexec", ["bash", "/tmp/arch_store_actions.sh"])
167+
168+
response = pq.QMessageBox.question(settings_page,
169+
lpak.get("Select a version", language),
170+
lpak.get("Do you want to install the stable version?", language),
171+
pq.QMessageBox.StandardButton.Yes | pq.QMessageBox.StandardButton.No,
172+
pq.QMessageBox.StandardButton.No
173+
)
174+
175+
if response == pq.QMessageBox.StandardButton.Yes:
176+
remove_other_version_command = "sudo pacman -Rns arch-store-git --noconfirm"
177+
makepkg_command = f"{aur_method} -S arch-store --noconfirm"
178+
else:
179+
remove_other_version_command = "sudo pacman -Rns arch-store --noconfirm"
180+
makepkg_command = f"{aur_method} -S arch-store-git --noconfirm"
181+
182+
with open(f"/tmp/arch_store_actions.sh", "w") as f:
183+
f.write("#!/bin/bash\n")
184+
f.write(remove_other_version_command+"\n")
185+
f.write(makepkg_command+"\n")
186+
187+
operations_window = pq.QWidget()
188+
operations_window.setWindowTitle(lpak.get("start update", language))
189+
operations_window.setWindowIcon(QIcon("icon.png"))
190+
layout = pq.QVBoxLayout(operations_window)
191+
install_label = pq.QLabel(lpak.get("click to start update", language))
192+
start_button = pq.QPushButton(lpak.get("start update", language))
193+
start_button.pressed.connect(lambda: start_thread_operations(install_label, start_button))
194+
progress_bar = pq.QProgressBar()
195+
196+
layout.addWidget(install_label)
197+
layout.addWidget(progress_bar)
198+
layout.addWidget(start_button)
199+
200+
operations_window.show()
201+
else:
202+
response = pq.QMessageBox.question(settings_page,
203+
lpak.get("Do you want to open GitHub?", language),
204+
lpak.get("It appears that you installed ArchStore from the script. Would you like to open GitHub to rerun the script?", language),
205+
pq.QMessageBox.StandardButton.Yes | pq.QMessageBox.StandardButton.No,
206+
pq.QMessageBox.StandardButton.No
207+
)
208+
209+
if response == pq.QMessageBox.StandardButton.Yes:
210+
webbrowser.open("https://github.com/Samuobe/Arch-Store?tab=readme-ov-file#automatic-script")
211+
212+
112213
#Other
113214
def settings_reset_settings(working_dir, avaible_languages, language):
114215
os.remove(f"{working_dir}/settings.conf")
@@ -153,6 +254,9 @@ def settings_reset_settings(working_dir, avaible_languages, language):
153254
#RESET
154255
button_reset_settings= pq.QPushButton(lpak.get("reset settings", language))
155256
button_reset_settings.pressed.connect(lambda: settings_reset_settings(working_dir, avaible_languages, language))
257+
#update Arch Store
258+
button_update_archStore = pq.QPushButton(lpak.get("Update ArchStore", language))
259+
button_update_archStore.pressed.connect(update_arch_store)
156260
#change AUR method
157261
label_aur_method = pq.QLabel(lpak.get("aur method", language)+": "+aur_method)
158262
button_change_aur_method = pq.QPushButton(lpak.get("change", language))
@@ -178,6 +282,13 @@ def github_button():
178282
author_label = pq.QLabel(lpak.get("made whit heart by Samuobe", language))
179283
project_link = pq.QPushButton(lpak.get("github project", language))
180284
project_link.pressed.connect(github_button)
285+
#Version
286+
version_label = pq.QLabel(lpak.get("version", language))
287+
if script_installation_status == False:
288+
archstore_installation_method = "AUR"
289+
else:
290+
archstore_installation_method = "Script"
291+
version_label_var = pq.QLabel(f"{version} ({lpak.get("Installated with", language)} {lpak.get(archstore_installation_method, language)})")
181292
#LINE
182293
line_separazione = pq.QFrame()
183294
line_separazione.setFrameShape(pq.QFrame.Shape.HLine)
@@ -188,6 +299,7 @@ def github_button():
188299
layout.addWidget(settings_label_title)
189300
layout.addWidget(settings_label_title, 0, 0, 1, 2)
190301
layout.addWidget(button_reset_settings, 0, 3)
302+
layout.addWidget(button_update_archStore, 1, 3)
191303
layout.addWidget(settings_label_repo, 1, 0)
192304
layout.addWidget(label_repo_pacman, 2, 0)
193305
layout.addWidget(button_repo_pacman, 2, 1)
@@ -199,11 +311,9 @@ def github_button():
199311
layout.addWidget(button_change_aur_method, 5, 1)
200312
layout.addWidget(empty_label, 6, 0)
201313
layout.addWidget(label_other_settings, 7, 0)
202-
#setLayout(layout)
203314
#
204315
layout.addWidget(label_language, 8, 0)
205-
layout.addWidget(menu_select_language, 8, 1)
206-
316+
layout.addWidget(menu_select_language, 8, 1)
207317

208318
layout.addWidget(appimagesdir_label, 9, 0)
209319
layout.addWidget(appimagesdir_button, 9, 1)
@@ -214,6 +324,9 @@ def github_button():
214324
layout.addWidget(author_label, 13, 0)
215325
layout.addWidget(project_link, 13, 1)
216326

327+
layout.addWidget(version_label, 15, 0)
328+
layout.addWidget(version_label_var, 15, 1)
329+
217330
layout.setRowStretch(layout.rowCount(), 1)
218331

219332
settings_page.show()

0 commit comments

Comments
 (0)