Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3f5aef7f
Commit
3f5aef7f
authored
Jun 20, 1997
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow specifying own resources for all dialogs
Allow changing labels on yesnocancel dialog
parent
1b3904b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
Mac/Lib/EasyDialogs.py
Mac/Lib/EasyDialogs.py
+15
-7
No files found.
Mac/Lib/EasyDialogs.py
View file @
3f5aef7f
...
...
@@ -18,7 +18,7 @@ import Qd
import
QuickDraw
import
Dlg
,
Win
,
Evt
,
Events
# sdm7g
def
Message
(
msg
):
def
Message
(
msg
,
id
=
256
):
"""Display a MESSAGE string.
Return when the user clicks the OK button or presses Return.
...
...
@@ -26,7 +26,6 @@ def Message(msg):
The MESSAGE string can be at most 255 characters long.
"""
id
=
256
d
=
GetNewDialog
(
id
,
-
1
)
if
not
d
:
print
"Can't get DLOG resource with id ="
,
id
...
...
@@ -40,7 +39,7 @@ def Message(msg):
return
def
AskString
(
prompt
,
default
=
""
):
def
AskString
(
prompt
,
default
=
""
,
id
=
257
):
"""Display a PROMPT string and a text entry field with a DEFAULT string.
Return the contents of the text entry field when the user clicks the
...
...
@@ -73,7 +72,7 @@ def AskString(prompt, default = ""):
if
n
==
2
:
return
None
def
AskYesNoCancel
(
question
,
default
=
0
):
def
AskYesNoCancel
(
question
,
default
=
0
,
yes
=
None
,
no
=
None
,
cancel
=
None
,
id
=
258
):
## """Display a QUESTION string which can be answered with Yes or No.
##
## Return 1 when the user clicks the Yes button.
...
...
@@ -86,7 +85,6 @@ def AskYesNoCancel(question, default = 0):
## The QUESTION strign ca be at most 255 characters.
## """
id
=
258
d
=
GetNewDialog
(
id
,
-
1
)
if
not
d
:
print
"Can't get DLOG resource with id ="
,
id
...
...
@@ -99,6 +97,15 @@ def AskYesNoCancel(question, default = 0):
# The question string is item 5
tp
,
h
,
rect
=
d
.
GetDialogItem
(
5
)
SetDialogItemText
(
h
,
question
)
if
yes
!=
None
:
tp
,
h
,
rect
=
d
.
GetDialogItem
(
2
)
h
.
as_Control
().
SetControlTitle
(
yes
)
if
no
!=
None
:
tp
,
h
,
rect
=
d
.
GetDialogItem
(
3
)
h
.
as_Control
().
SetControlTitle
(
no
)
if
cancel
!=
None
:
tp
,
h
,
rect
=
d
.
GetDialogItem
(
4
)
h
.
as_Control
().
SetControlTitle
(
cancel
)
d
.
SetDialogCancelItem
(
4
)
if
default
==
1
:
d
.
SetDialogDefaultItem
(
2
)
...
...
@@ -122,10 +129,10 @@ screenbounds = screenbounds[0]+4, screenbounds[1]+4, \
class
ProgressBar
:
def
__init__
(
self
,
title
=
"Working..."
,
maxval
=
100
,
label
=
""
):
def
__init__
(
self
,
title
=
"Working..."
,
maxval
=
100
,
label
=
""
,
id
=
259
):
self
.
maxval
=
maxval
self
.
curval
=
-
1
self
.
d
=
GetNewDialog
(
259
,
-
1
)
self
.
d
=
GetNewDialog
(
id
,
-
1
)
self
.
title
(
title
)
self
.
label
(
label
)
self
.
_update
(
0
)
...
...
@@ -206,6 +213,7 @@ def test():
Message
(
"Testing EasyDialogs."
)
ok
=
AskYesNoCancel
(
"Do you want to proceed?"
)
ok
=
AskYesNoCancel
(
"Do you want to identify?"
,
yes
=
"Indentify"
,
no
=
"Don't identify"
)
if
ok
>
0
:
s
=
AskString
(
"Enter your first name"
)
Message
(
"Thank you,
\
015
%s"
%
`s`
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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