FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
StreamController/src/windows/Store/StorePage.py at main · StreamController/StreamController · GitHub
StreamController
/
StreamController
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
119
Star
1.1k
Code
Issues
20
Pull requests
13
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
StreamController
/
src
/
windows
/
Store
/
StorePage.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
136 lines (105 loc) · 4.85 KB
Breadcrumbs
StreamController
/
src
/
windows
/
Store
/
StorePage.py
Copy path
File metadata and controls
136 lines (105 loc) · 4.85 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
"""
Year: 2023
This program 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
any later version.
This programm comes with ABSOLUTELY NO WARRANTY!
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
# Import gtk modules
import
gi
from
src
.
windows
.
Store
.
StorePageSection
import
StorePageSection
gi
.
require_version
(
"Gtk"
,
"4.0"
)
gi
.
require_version
(
"Adw"
,
"1"
)
from
gi
.
repository
import
Gtk
,
GLib
# Import python modules
from
fuzzywuzzy
import
fuzz
import
threading
from
loguru
import
logger
as
log
# Import own modules
from
src
.
windows
.
Store
.
InfoPage
import
InfoPage
from
GtkHelper
.
GtkHelper
import
ErrorPage
from
src
.
windows
.
Store
.
NoConnectionError
import
NoConnectionError
from
packaging
import
version
# Typing
from
typing
import
TYPE_CHECKING
if
TYPE_CHECKING
:
from
src
.
windows
.
Store
.
Store
import
Store
# Import globals
import
globals
as
gl
class
StorePage
(
Gtk
.
Stack
):
def
__init__
(
self
,
store
:
"Store"
):
super
().
__init__
()
self
.
set_hexpand
(
True
)
self
.
set_vexpand
(
True
)
self
.
set_margin_start
(
15
)
self
.
set_margin_end
(
15
)
self
.
set_margin_top
(
15
)
self
.
set_margin_bottom
(
15
)
self
.
set_transition_duration
(
200
)
self
.
set_transition_type
(
Gtk
.
StackTransitionType
.
SLIDE_LEFT_RIGHT
)
self
.
store
=
store
self
.
build
()
def
build
(
self
):
self
.
main_box
=
Gtk
.
Box
(
orientation
=
Gtk
.
Orientation
.
VERTICAL
,
hexpand
=
True
)
self
.
add_titled
(
self
.
main_box
,
"Store"
,
"Store"
)
self
.
section_stack
=
Gtk
.
Stack
(
vexpand
=
True
)
self
.
main_box
.
append
(
self
.
section_stack
)
self
.
compatible_section
=
StorePageSection
()
self
.
incompatible_section
=
StorePageSection
()
self
.
incompatible_section
.
nothing_here
.
set_icon_name
(
"face-smile-symbolic"
)
self
.
section_switcher
=
Gtk
.
StackSwitcher
(
stack
=
self
.
section_stack
,
margin_bottom
=
15
)
self
.
main_box
.
prepend
(
self
.
section_switcher
)
self
.
section_stack
.
add_titled
(
self
.
compatible_section
,
"Compatible"
,
"Compatible"
)
self
.
section_stack
.
add_titled
(
self
.
incompatible_section
,
"Incompatible"
,
"Incompatible"
)
self
.
section_stack
.
set_visible_child
(
self
.
compatible_section
)
self
.
loading_box
=
Gtk
.
Box
(
orientation
=
Gtk
.
Orientation
.
VERTICAL
,
hexpand
=
True
,
vexpand
=
True
,
visible
=
False
,
valign
=
Gtk
.
Align
.
CENTER
)
self
.
main_box
.
append
(
self
.
loading_box
)
self
.
spinner
=
Gtk
.
Spinner
(
spinning
=
False
)
self
.
loading_box
.
append
(
self
.
spinner
)
self
.
loading_text
=
Gtk
.
Label
(
label
=
gl
.
lm
.
get
(
"store.page.loading-spinner.label"
))
self
.
loading_box
.
append
(
self
.
loading_text
)
# Info page
self
.
info_page
=
InfoPage
(
self
)
self
.
add_titled
(
self
.
info_page
,
"Info"
,
"Info"
)
# Error page
self
.
no_connection_page
=
NoConnectionError
()
self
.
add_titled
(
self
.
no_connection_page
,
"Error"
,
"Error"
)
def
set_loading
(
self
):
GLib
.
idle_add
(
self
.
section_stack
.
set_visible
,
False
)
# GLib.idle_add(self.bottom_box.set_visible, False)
GLib
.
idle_add
(
self
.
loading_box
.
set_visible
,
True
)
# threading.Thread(target=self.spinner.set_spinning, args=(True,), name="spinner_thread").start()
GLib
.
idle_add
(
self
.
spinner
.
set_spinning
,
True
)
GLib
.
idle_add
(
self
.
section_switcher
.
set_visible
,
False
)
def
set_loaded
(
self
):
GLib
.
idle_add
(
self
.
section_stack
.
set_visible
,
True
)
# GLib.idle_add(self.bottom_box.set_visible, True)
GLib
.
idle_add
(
self
.
loading_box
.
set_visible
,
False
)
GLib
.
idle_add
(
self
.
spinner
.
set_spinning
,
False
)
GLib
.
idle_add
(
self
.
section_switcher
.
set_visible
,
True
)
GLib
.
idle_add
(
self
.
hide_stack_switcher_if_all_compatible
)
def
hide_stack_switcher_if_all_compatible
(
self
):
if
not
self
.
incompatible_section
.
are_items_present
():
self
.
section_switcher
.
set_visible
(
False
)
def
set_info_visible
(
self
,
visible
:
bool
):
if
visible
:
self
.
set_visible_child
(
self
.
info_page
)
self
.
store
.
back_button
.
set_visible
(
True
)
else
:
self
.
set_visible_child
(
self
.
main_box
)
self
.
store
.
back_button
.
set_visible
(
False
)
def
show_connection_error
(
self
):
self
.
set_visible_child
(
self
.
no_connection_page
)
def
hide_connection_error
(
self
):
self
.
set_visible_child
(
self
.
main_box
)
def
check_required_version
(
self
,
app_version_to_check
:
str
,
is_min_app_version
:
bool
=
False
):
if
is_min_app_version
:
if
app_version_to_check
is
None
:
return
True
min_version
=
version
.
parse
(
app_version_to_check
)
app_version
=
version
.
parse
(
gl
.
app_version
)
return
min_version
<
app_version
Back
|
FazBrowse Home
|
New Git URL