Skip to content

Commit

Permalink
Merge pull request #60 from vcatafesta/main
Browse files Browse the repository at this point in the history
qui 24 ago 2023 15:00:39 -04 Vilmar Catafesta ([email protected])
  • Loading branch information
bigbruno authored Aug 25, 2023
2 parents 97393d0 + c4c9bfe commit c3a8958
Show file tree
Hide file tree
Showing 12 changed files with 423 additions and 602 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Description: Big Store installing programs for BigLinux
#
# Created: 2020/01/11
# Altered: 2023/08/18
# Altered: 2023/08/24
#
# Copyright (c) 2023-2023, Vilmar Catafesta <[email protected]>
# 2022-2023, Bruno Gonçalves <www.biglinux.com.br>
Expand Down Expand Up @@ -34,16 +34,16 @@
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

APP="${0##*/}"
_VERSION_="1.0.0-20230818"
_VERSION_="1.0.0-20230824"
export BOOTLOG="/tmp/bigstore-$USER-$(date +"%d%m%Y").log"
export LOGGER='/dev/tty8'
export HOME_FOLDER="$HOME/.bigstore"
export TMP_FOLDER="/tmp/bigstore-$USER"
LIBRARY=${LIBRARY:-'/usr/share/bigbashview/bcc/shell'}
[[ -f "${LIBRARY}/bcclib.sh" ]] && source "${LIBRARY}/bcclib.sh"
[[ -f "${LIBRARY}/bcclib.sh" ]] && source "${LIBRARY}/bcclib.sh"
[[ -f "${LIBRARY}/bstrlib.sh" ]] && source "${LIBRARY}/bstrlib.sh"

function sh_config {
function sh_config() {
#Translation
export TEXTDOMAINDIR="/usr/share/locale"
export TEXTDOMAIN=big-store
Expand All @@ -53,22 +53,22 @@ function sh_config {
declare -g bigstore_icon_file='icons/icon.svg'
declare -g TITLE="Big-Store"
declare -gA Amsg=([error_open]=$(gettext $"Outra instância do Big-Store já está em execução.")
[error_access_dir]=$(gettext $"Erro ao acessar o diretório:")
[error_access_dir]=$(gettext $"Erro ao acessar o diretório:")
)
}

function sh_check_big_store_is_running {
function sh_check_big_store_is_running() {
local PID

if PID=$(pgrep -f 'Big-Store') && [[ -n "$PID" ]]; then
# notify-send -u critical --icon=big-store --app-name "$0" "$TITLE" "${Amsg[error_open]}" --expire-time=2000
# kdialog --title "$TITLE" --icon warning --msgbox "${Amsg[error_open]}"
# notify-send -u critical --icon=big-store --app-name "$0" "$TITLE" "${Amsg[error_open]}" --expire-time=2000
# kdialog --title "$TITLE" --icon warning --msgbox "${Amsg[error_open]}"
yad --title "$TITLE" --image=big-store --text "${Amsg[error_open]}\nPID:$PID" --button="OK":0
exit 1
fi
}

function sh_main {
function sh_main() {
local resolution
local half_resolution

Expand All @@ -79,24 +79,24 @@ function sh_main {
return 1
}

[[ ! -e "$snap_cache_file" ]] || [[ "$(find "$snap_cache_file" -mtime +1 -print)" ]] && sh_update_cache_snap &
[[ ! -e "$snap_cache_file" ]] || [[ "$(find "$snap_cache_file" -mtime +1 -print)" ]] && sh_update_cache_snap &
[[ ! -e "$flatpak_cache_file" ]] || [[ "$(find "$flatpak_cache_file" -mtime +1 -print)" ]] && sh_update_cache_flatpak &

resolution=$(xrandr | grep -oP 'primary \K[0-9]+x\K[0-9]+')
half_resolution=$((resolution / 2))
# Save dynamic screenshot resolution
echo "$half_resolution" > "${TMP_FOLDER}/screenshot-resolution.txt"
echo "$half_resolution" >"${TMP_FOLDER}/screenshot-resolution.txt"

# sh_update_cache_flatpak &
# sh_update_cache_flatpak &
COMMON_OPTIONS="QT_QPA_PLATFORM=xcb SDL_VIDEODRIVER=x11 WINIT_UNIX_BACKEND=x11 GDK_BACKEND=x11 bigbashview -n \"$TITLE\" -w maximized "
if [[ -n "$1" ]]; then
case "$1" in
"category") eval "$COMMON_OPTIONS index.sh.htm?category=\"$2\" -i $bigstore_icon_file" ;;
"category") eval "$COMMON_OPTIONS index.sh.htm?category=\"$2\" -i $bigstore_icon_file" ;;
"appstream") eval "$COMMON_OPTIONS view_appstream.sh.htm?pkg_name=\"$2\" -i $bigstore_icon_file" ;;
"aur") eval "$COMMON_OPTIONS view_aur.sh.htm?pkg_name=\"$2\" -i $bigstore_icon_file" ;;
"flatpak") eval "$COMMON_OPTIONS view_flatpak.sh.htm?pkg_name=\"$2\" -i $bigstore_icon_file" ;;
"snap") eval "$COMMON_OPTIONS view_snap.sh.htm?pkg_id=\"$2\" -i $bigstore_icon_file" ;;
*) eval "$COMMON_OPTIONS index.sh.htm?search=\"$1\" -i $bigstore_icon_file" ;;
"aur") eval "$COMMON_OPTIONS view_aur.sh.htm?pkg_name=\"$2\" -i $bigstore_icon_file" ;;
"flatpak") eval "$COMMON_OPTIONS view_flatpak.sh.htm?pkg_name=\"$2\" -i $bigstore_icon_file" ;;
"snap") eval "$COMMON_OPTIONS view_snap.sh.htm?pkg_id=\"$2\" -i $bigstore_icon_file" ;;
*) eval "$COMMON_OPTIONS index.sh.htm?search=\"$1\" -i $bigstore_icon_file" ;;
esac
else
eval "$COMMON_OPTIONS index.sh.htm -i $bigstore_icon_file"
Expand All @@ -106,4 +106,4 @@ function sh_main {
#sh_debug
sh_config
sh_check_big_store_is_running
sh_main
sh_main "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@
gi.require_version("Pamac", "11")
from gi.repository import Pamac

#biblioteca apresenta erro de segmentação ao ser destruido quando o app é finalizado: destroy gettext
# biblioteca apresenta erro de segmentação ao ser destruido quando o app é finalizado: destroy gettext
import gettext
lang_translations = gettext.translation("big-store", localedir="/usr/share/locale", fallback=True)

lang_translations = gettext.translation(
"big-store", localedir="/usr/share/locale", fallback=True
)
lang_translations.install()
#define _ shortcut for translations
# define _ shortcut for translations
_ = lang_translations.gettext
TMP_FOLDER = os.environ["TMP_FOLDER"]


def print_pkg_details(details):
print(
'<a onclick="disableBody();" href="view_appstream.sh.htm?pkg_name='
Expand Down Expand Up @@ -144,6 +148,7 @@ def print_pkg_details(details):
config.set_enable_flatpak(False)
config.set_enable_snap(False)
db = Pamac.Database(config=config)
num = 0

# To multi packages
# db.enable_appstream()
Expand All @@ -158,11 +163,24 @@ def print_pkg_details(details):
pkg = db.get_pkg(app_list)
if pkg:
print_pkg_details(pkg)
num += 1
else:
file_path = TMP_FOLDER + "/category_aur.txt"
with open(file_path, "a") as f:
print(app_list, file=f)

if num > 0:
print(
'<script>runAvatarAppstream(); $(document).ready(function () {$("#box_appstream").show();});</script>'
)
with open(TMP_FOLDER + "/appstream_number.html", "a") as f:
f.write(str(num))
print(
'<script>document.getElementById("appstream_number").innerHTML = "',
num,
'";</script>',
)

# Simple Search
# for pkg in pkgs:
# print_pkg_details (pkg)
Expand Down
Loading

0 comments on commit c3a8958

Please sign in to comment.