Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
5d900a4d
Commit
5d900a4d
authored
8 years ago
by
Glenn Glazer
Browse files
Options
Downloads
Patches
Plain Diff
SL-321 add trinary widget to InstallerUserMessage
parent
e8785677
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/viewer_components/manager/InstallerUserMessage.py
+43
-9
43 additions, 9 deletions
indra/viewer_components/manager/InstallerUserMessage.py
indra/viewer_components/manager/SL_Launcher
+0
-1
0 additions, 1 deletion
indra/viewer_components/manager/SL_Launcher
with
43 additions
and
10 deletions
indra/viewer_components/manager/InstallerUserMessage.py
+
43
−
9
View file @
5d900a4d
...
@@ -58,8 +58,8 @@ def __init__(self, text="", title="", width=500, height=200, icon_name = None, i
...
@@ -58,8 +58,8 @@ def __init__(self, text="", title="", width=500, height=200, icon_name = None, i
self
.
config
(
background
=
'
black
'
)
self
.
config
(
background
=
'
black
'
)
# background="..." doesn't work on MacOS for radiobuttons or progress bars
# background="..." doesn't work on MacOS for radiobuttons or progress bars
# http://tinyurl.com/tkmacbuttons
# http://tinyurl.com/tkmacbuttons
ttk
.
Style
().
configure
(
'
Linden.TLabel
'
,
foreground
=
'
#487A7B
'
,
background
=
'
black
'
)
ttk
.
Style
().
configure
(
'
Linden.TLabel
'
,
foreground
=
InstallerUserMessage
.
linden_green
,
background
=
'
black
'
)
ttk
.
Style
().
configure
(
'
Linden.TButton
'
,
foreground
=
'
#487A7B
'
,
background
=
'
black
'
)
ttk
.
Style
().
configure
(
'
Linden.TButton
'
,
foreground
=
InstallerUserMessage
.
linden_green
,
background
=
'
black
'
)
ttk
.
Style
().
configure
(
"
black.Horizontal.TProgressbar
"
,
foreground
=
InstallerUserMessage
.
linden_green
,
background
=
'
black
'
)
ttk
.
Style
().
configure
(
"
black.Horizontal.TProgressbar
"
,
foreground
=
InstallerUserMessage
.
linden_green
,
background
=
'
black
'
)
#This bit of configuration centers the window on the screen
#This bit of configuration centers the window on the screen
...
@@ -136,8 +136,8 @@ def basic_message(self, message):
...
@@ -136,8 +136,8 @@ def basic_message(self, message):
self
.
mainloop
()
self
.
mainloop
()
def
binary_choice_message
(
self
,
message
,
true
=
'
Yes
'
,
false
=
'
No
'
):
def
binary_choice_message
(
self
,
message
,
true
=
'
Yes
'
,
false
=
'
No
'
):
#
on
e: first option, returns True
#
tru
e: first option, returns True
#
two
: second option, returns False
#
false
: second option, returns False
#usage is kind of opaque and relies on this object persisting after the window destruction to pass back choice
#usage is kind of opaque and relies on this object persisting after the window destruction to pass back choice
#usage:
#usage:
# frame = InstallerUserMessage.InstallerUserMessage( ... )
# frame = InstallerUserMessage.InstallerUserMessage( ... )
...
@@ -164,6 +164,38 @@ def binary_choice_message(self, message, true = 'Yes', false = 'No'):
...
@@ -164,6 +164,38 @@ def binary_choice_message(self, message, true = 'Yes', false = 'No'):
self
.
update
()
self
.
update
()
self
.
mainloop
()
self
.
mainloop
()
def
trinary_choice_message
(
self
,
message
,
one
=
1
,
two
=
2
,
three
=
3
):
#one: first option, returns 1
#two: second option, returns 2
#three: third option, returns 3
#usage is kind of opaque and relies on this object persisting after the window destruction to pass back choice
#usage:
# frame = InstallerUserMessage.InstallerUserMessage( ... )
# frame = frame.binary_choice_message( ... )
# (wait for user to click)
# value = frame.choice.get()
self
.
text_label
=
tk
.
Label
(
text
=
message
)
#command registers the callback to the method named. We want the frame to go away once clicked.
self
.
button_one
=
ttk
.
Radiobutton
(
text
=
one
,
variable
=
self
.
choice
,
value
=
1
,
command
=
self
.
_delete_window
,
style
=
'
Linden.TButton
'
)
self
.
button_two
=
ttk
.
Radiobutton
(
text
=
two
,
variable
=
self
.
choice
,
value
=
2
,
command
=
self
.
_delete_window
,
style
=
'
Linden.TButton
'
)
self
.
button_three
=
ttk
.
Radiobutton
(
text
=
three
,
variable
=
self
.
choice
,
value
=
3
,
command
=
self
.
_delete_window
,
style
=
'
Linden.TButton
'
)
self
.
set_colors
(
self
.
text_label
)
self
.
set_colors
(
self
.
image_label
)
#pad, direction and weight are all experimentally derived by retrying various values
self
.
image_label
.
grid
(
row
=
1
,
column
=
1
,
rowspan
=
4
,
sticky
=
'
W
'
)
self
.
text_label
.
grid
(
row
=
1
,
column
=
2
,
rowspan
=
4
,
padx
=
5
)
self
.
button_one
.
grid
(
row
=
1
,
column
=
3
,
sticky
=
'
W
'
,
pady
=
5
)
self
.
button_two
.
grid
(
row
=
2
,
column
=
3
,
sticky
=
'
W
'
,
pady
=
5
)
self
.
button_three
.
grid
(
row
=
3
,
column
=
3
,
sticky
=
'
W
'
,
pady
=
5
)
self
.
auto_resize
(
row_count
=
3
,
column_count
=
3
,
heavy_column
=
3
)
#self.button_two.deselect()
self
.
update
()
self
.
mainloop
()
def
progress_bar
(
self
,
message
=
None
,
size
=
0
,
interval
=
100
,
pb_queue
=
None
):
def
progress_bar
(
self
,
message
=
None
,
size
=
0
,
interval
=
100
,
pb_queue
=
None
):
#Best effort attempt at a real progress bar
#Best effort attempt at a real progress bar
# This is what Tk calls "determinate mode" rather than "indeterminate mode"
# This is what Tk calls "determinate mode" rather than "indeterminate mode"
...
@@ -248,6 +280,13 @@ def set_and_check(frame, value):
...
@@ -248,6 +280,13 @@ def set_and_check(frame, value):
print
frame3
.
choice
.
get
()
print
frame3
.
choice
.
get
()
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
#trinary choice test. User destroys window when they select.
frame3a
=
InstallerUserMessage
(
text
=
"
Something in the way she knows....
"
,
title
=
"
Beatles Quotes for 200
"
,
icon_name
=
"
head-sl-logo.gif
"
)
frame3a
.
trinary_choice_message
(
message
=
"
And all I have to do is think of her.
"
,
one
=
"
Don
'
t want to leave her now
"
,
two
=
'
You know I believe and how
'
,
three
=
'
John is Dead
'
)
print
frame3a
.
choice
.
get
()
sys
.
stdout
.
flush
()
#progress bar
#progress bar
queue
=
Queue
.
Queue
()
queue
=
Queue
.
Queue
()
thread
=
ThreadedClient
(
queue
)
thread
=
ThreadedClient
(
queue
)
...
@@ -257,9 +296,4 @@ def set_and_check(frame, value):
...
@@ -257,9 +296,4 @@ def set_and_check(frame, value):
frame4
=
InstallerUserMessage
(
text
=
"
Something in the way she knows....
"
,
title
=
"
Beatles Quotes for 300
"
,
icon_name
=
"
head-sl-logo.gif
"
)
frame4
=
InstallerUserMessage
(
text
=
"
Something in the way she knows....
"
,
title
=
"
Beatles Quotes for 300
"
,
icon_name
=
"
head-sl-logo.gif
"
)
frame4
.
progress_bar
(
message
=
"
You
'
re asking me will my love grow
"
,
size
=
100
,
pb_queue
=
queue
)
frame4
.
progress_bar
(
message
=
"
You
'
re asking me will my love grow
"
,
size
=
100
,
pb_queue
=
queue
)
print
"
frame defined
"
print
"
frame defined
"
frame4
.
mainloop
()
frame4
.
mainloop
()
This diff is collapsed.
Click to expand it.
indra/viewer_components/manager/SL_Launcher
+
0
−
1
View file @
5d900a4d
...
@@ -34,7 +34,6 @@ elif sys.platform.startswith("win") or sys.platform.startswith("cyg"):
...
@@ -34,7 +34,6 @@ elif sys.platform.startswith("win") or sys.platform.startswith("cyg"):
elif
os
.
path
.
isfile
(
os
.
path
.
join
(
cwd
,
"
SecondLifeTest.exe
"
)):
elif
os
.
path
.
isfile
(
os
.
path
.
join
(
cwd
,
"
SecondLifeTest.exe
"
)):
executable_name
=
"
SecondLifeTest.exe
"
executable_name
=
"
SecondLifeTest.exe
"
else
:
else
:
#unsupported by prototypeS
sys
.
exit
(
"
Can
'
t find Windows viewer binary
"
)
sys
.
exit
(
"
Can
'
t find Windows viewer binary
"
)
elif
sys
.
platform
.
startswith
(
"
linux
"
):
elif
sys
.
platform
.
startswith
(
"
linux
"
):
executable_name
=
"
secondlife
"
executable_name
=
"
secondlife
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment