Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ideascube
ARCHIVED Kiwix Hotspot
Commits
8930d4ea
Commit
8930d4ea
authored
Sep 19, 2018
by
rgaudin
Browse files
Fixed
#234
: File size entry is now a combobox matching standard SD cards sizes
parent
39b05050
Changes
4
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
8930d4ea
2.0-rc11
* Fixed an unmount issue on Linux
* File size entry is now a selection list of standard SD cards sizes
2.0-rc10
* Fixed wikifundi config regression
...
...
pibox-installer/data.py
View file @
8930d4ea
...
...
@@ -21,6 +21,7 @@ content_file = os.path.join(data_dir, 'contents.json')
ansiblecube_path
=
os
.
path
.
join
(
data_dir
,
"ansiblecube"
)
mirror
=
"http://download.kiwix.org"
sdcard_sizes
=
(
8
,
16
,
32
,
64
,
128
,
200
,
256
)
ideascube_languages
=
[
(
'am'
,
u
'አማርኛ'
),
...
...
pibox-installer/gui.py
View file @
8930d4ea
...
...
@@ -268,6 +268,13 @@ class Application:
self
.
component
.
language_combobox
.
pack_start
(
renderer
,
True
)
self
.
component
.
language_combobox
.
add_attribute
(
renderer
,
"text"
,
1
)
# SD sizes for image size
for
ngb
in
data
.
sdcard_sizes
:
self
.
component
.
sizes_tree_store
.
append
([
str
(
ngb
),
"{} GB"
.
format
(
ngb
)])
renderer
=
Gtk
.
CellRendererText
()
self
.
component
.
size_combobox
.
pack_start
(
renderer
,
True
)
self
.
component
.
size_combobox
.
add_attribute
(
renderer
,
"text"
,
1
)
renderer
=
Gtk
.
CellRendererText
()
self
.
component
.
timezone_combobox
.
pack_start
(
renderer
,
True
)
self
.
component
.
timezone_combobox
.
add_attribute
(
renderer
,
"text"
,
0
)
...
...
@@ -276,7 +283,8 @@ class Application:
self
.
component
.
sd_card_combobox
.
connect
(
"changed"
,
lambda
_
:
self
.
update_free_space
())
self
.
component
.
sd_card_refresh_button
.
connect
(
"clicked"
,
self
.
sd_card_refresh_button_clicked
)
self
.
component
.
output_stack
.
connect
(
"notify::visible-child"
,
lambda
switch
,
state
:
self
.
update_free_space
())
self
.
component
.
size_entry
.
connect
(
"changed"
,
lambda
_
:
self
.
update_free_space
())
self
.
component
.
size_combobox
.
connect
(
"changed"
,
lambda
_
:
self
.
update_free_space
())
types
=
[
info
[
"typ"
]
for
info
in
sd_card_info
.
informations
]
self
.
component
.
sd_card_list_store
=
Gtk
.
ListStore
(
*
types
)
...
...
@@ -468,7 +476,7 @@ class Application:
self
.
component
.
build_path_chooser
.
unselect_all
()
# size
self
.
component
.
size_
entry
.
set_text
(
''
)
self
.
component
.
size_
combobox
.
set_active
(
0
)
# content
for
key
in
(
'kalite'
,
'wikifundi'
):
...
...
@@ -811,7 +819,9 @@ class Application:
except
Exception
:
size
=
None
if
size
is
not
None
:
self
.
component
.
size_entry
.
set_text
(
str
(
size
))
sd_size
=
min
(
filter
(
lambda
x
:
x
>=
size
,
data
.
sdcard_sizes
),
default
=
data
.
sdcard_sizes
[
-
1
])
self
.
component
.
size_combobox
.
set_active
(
data
.
sdcard_sizes
.
index
(
sd_size
))
# content
if
"content"
in
config
and
isinstance
(
config
[
"content"
],
dict
):
...
...
@@ -896,7 +906,7 @@ class Application:
if
button
.
get_active
()]
try
:
size
=
int
(
self
.
component
.
size_
entry
.
get_text
()
)
*
ONE_GB
size
=
data
.
sdcard_sizes
[
self
.
component
.
size_
combobox
.
get_active
()
]
*
ONE_GB
except
Exception
:
size
=
None
...
...
@@ -1182,10 +1192,10 @@ class Application:
validate_label
(
self
.
component
.
free_space_label1
,
condition
)
validate_label
(
self
.
component
.
free_space_label2
,
condition
)
# size
_entry
should be at least base_image size
# size should be at least base_image size
size
=
self
.
get_output_size
()
validate_label
(
self
.
component
.
size_
entry
,
self
.
component
.
size_
combobox
,
size
>=
get_content
(
'pibox_base_image'
)[
'expanded_size'
])
for
row
in
self
.
component
.
zim_list_store
:
...
...
@@ -1205,7 +1215,7 @@ class Application:
size
=
int
(
self
.
component
.
sd_card_list_store
[
sd_card_id
][
get_size_index
])
else
:
try
:
size
=
int
(
self
.
component
.
size_
entry
.
get_text
()
)
*
ONE_GB
size
=
data
.
sdcard_sizes
[
self
.
component
.
size_
combobox
.
get_active
()
]
*
ONE_GB
except
Exception
:
size
=
-
1
...
...
ui.glade
View file @
8930d4ea
...
...
@@ -15,6 +15,14 @@
<column
type=
"gchararray"
/>
</columns>
</object>
<object
class=
"GtkListStore"
id=
"sizes_tree_store"
>
<columns>
<!-- column-name size -->
<column
type=
"gchararray"
/>
<!-- column-name displayed size -->
<column
type=
"gchararray"
/>
</columns>
</object>
<object
class=
"GtkFileFilter"
id=
"logo_filter"
>
<mime-types>
<mime-type>
image/png
</mime-type>
...
...
@@ -1024,15 +1032,16 @@ In File mode the image is created at build path, you can choose the size
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<child>
<object
class=
"Gtk
Entry
"
id=
"size_
entry
"
>
<object
class=
"Gtk
ComboBox
"
id=
"size_
combobox
"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"model"
>
sizes_tree_store
</property>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"pack_type"
>
end
</property>
<property
name=
"position"
>
0
</property>
<property
name=
"position"
>
1
</property>
</packing>
</child>
<child>
...
...
@@ -1040,7 +1049,7 @@ In File mode the image is created at build path, you can choose the size
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"tooltip_text"
translatable=
"yes"
>
Size of the image to build
</property>
<property
name=
"label"
translatable=
"yes"
>
File size
(GB)
:
</property>
<property
name=
"label"
translatable=
"yes"
>
File size:
</property>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment