Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
a5a49818
Kaydet (Commit)
a5a49818
authored
Tem 01, 1998
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Convert \n to \r in strings that are displayed in the dialogs.
üst
8e54abe9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
EasyDialogs.py
Mac/Lib/EasyDialogs.py
+19
-8
No files found.
Mac/Lib/EasyDialogs.py
Dosyayı görüntüle @
a5a49818
...
...
@@ -17,6 +17,18 @@ from Dlg import GetNewDialog, SetDialogItemText, GetDialogItemText, ModalDialog
import
Qd
import
QuickDraw
import
Dlg
,
Win
,
Evt
,
Events
# sdm7g
import
MacOS
import
string
def
cr2lf
(
text
):
if
'
\r
'
in
text
:
text
=
string
.
join
(
string
.
split
(
text
,
'
\r
'
),
'
\n
'
)
return
text
def
lf2cr
(
text
):
if
'
\n
'
in
text
:
text
=
string
.
join
(
string
.
split
(
text
,
'
\n
'
),
'
\r
'
)
return
text
def
Message
(
msg
,
id
=
256
):
"""Display a MESSAGE string.
...
...
@@ -31,7 +43,7 @@ def Message(msg, id=256):
print
"Can't get DLOG resource with id ="
,
id
return
tp
,
h
,
rect
=
d
.
GetDialogItem
(
2
)
SetDialogItemText
(
h
,
msg
)
SetDialogItemText
(
h
,
lf2cr
(
msg
)
)
d
.
SetDialogDefaultItem
(
1
)
while
1
:
n
=
ModalDialog
(
None
)
...
...
@@ -58,9 +70,9 @@ def AskString(prompt, default = "", id=257):
print
"Can't get DLOG resource with id ="
,
id
return
tp
,
h
,
rect
=
d
.
GetDialogItem
(
3
)
SetDialogItemText
(
h
,
prompt
)
SetDialogItemText
(
h
,
lf2cr
(
prompt
)
)
tp
,
h
,
rect
=
d
.
GetDialogItem
(
4
)
SetDialogItemText
(
h
,
default
)
SetDialogItemText
(
h
,
lf2cr
(
default
)
)
# d.SetDialogItem(4, 0, 255)
d
.
SetDialogDefaultItem
(
1
)
d
.
SetDialogCancelItem
(
2
)
...
...
@@ -68,7 +80,7 @@ def AskString(prompt, default = "", id=257):
n
=
ModalDialog
(
None
)
if
n
==
1
:
tp
,
h
,
rect
=
d
.
GetDialogItem
(
4
)
return
GetDialogItemText
(
h
)
return
cr2lf
(
GetDialogItemText
(
h
)
)
if
n
==
2
:
return
None
...
...
@@ -96,7 +108,7 @@ def AskYesNoCancel(question, default = 0, yes=None, no=None, cancel=None, id=258
# 4 = Cancel
# The question string is item 5
tp
,
h
,
rect
=
d
.
GetDialogItem
(
5
)
SetDialogItemText
(
h
,
question
)
SetDialogItemText
(
h
,
lf2cr
(
question
)
)
if
yes
!=
None
:
tp
,
h
,
rect
=
d
.
GetDialogItem
(
2
)
h
.
as_Control
()
.
SetControlTitle
(
yes
)
...
...
@@ -152,7 +164,7 @@ class ProgressBar:
"""label(text) - Set text in progress box"""
self
.
d
.
BringToFront
()
if
newstr
:
self
.
_label
=
newstr
[
0
]
self
.
_label
=
lf2cr
(
newstr
[
0
])
tp
,
text_h
,
rect
=
self
.
d
.
GetDialogItem
(
2
)
SetDialogItemText
(
text_h
,
self
.
_label
)
...
...
@@ -209,14 +221,13 @@ class ProgressBar:
def
test
():
import
time
import
MacOS
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`
)
Message
(
"Thank you,
\
n
%
s"
%
`s`
)
text
=
(
"Working Hard..."
,
"Hardly Working..."
,
"So far, so good!"
,
"Keep on truckin'"
)
bar
=
ProgressBar
(
"Progress, progress..."
,
100
)
...
...
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