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
8a09e1cc
Kaydet (Commit)
8a09e1cc
authored
Eki 20, 1998
tarafından
Barry Warsaw
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Saving/Restoring state into ~/.pynche file
üst
28e7b4cc
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
160 additions
and
27 deletions
+160
-27
ChipViewer.py
Tools/pynche/ChipViewer.py
+3
-0
DetailsViewer.py
Tools/pynche/DetailsViewer.py
+11
-4
ListViewer.py
Tools/pynche/ListViewer.py
+5
-1
Main.py
Tools/pynche/Main.py
+42
-9
PyncheWidget.py
Tools/pynche/PyncheWidget.py
+2
-2
StripViewer.py
Tools/pynche/StripViewer.py
+9
-2
Switchboard.py
Tools/pynche/Switchboard.py
+43
-2
TextViewer.py
Tools/pynche/TextViewer.py
+38
-7
TypeinViewer.py
Tools/pynche/TypeinViewer.py
+7
-0
__init__.py
Tools/pynche/__init__.py
+0
-0
No files found.
Tools/pynche/ChipViewer.py
Dosyayı görüntüle @
8a09e1cc
...
...
@@ -110,3 +110,6 @@ class ChipViewer:
colorname
=
self
.
__nearest
.
get_color
()
red
,
green
,
blue
=
self
.
__sb
.
colordb
()
.
find_byname
(
colorname
)
self
.
__sb
.
update_views
(
red
,
green
,
blue
)
def
save_options
(
self
,
optiondb
):
pass
Tools/pynche/DetailsViewer.py
Dosyayı görüntüle @
8a09e1cc
...
...
@@ -63,6 +63,7 @@ GRAV = 'Squash'
class
DetailsViewer
:
def
__init__
(
self
,
switchboard
,
parent
=
None
):
self
.
__sb
=
switchboard
optiondb
=
switchboard
.
optiondb
()
self
.
__red
,
self
.
__green
,
self
.
__blue
=
switchboard
.
current_rgb
()
# GUI
root
=
self
.
__root
=
Toplevel
(
parent
,
class_
=
'Pynche'
)
...
...
@@ -87,21 +88,21 @@ class DetailsViewer:
self
.
__l1
=
Label
(
frame
,
text
=
'Move Sliders:'
)
self
.
__l1
.
grid
(
row
=
1
,
column
=
0
,
sticky
=
E
)
self
.
__rvar
=
IntVar
()
self
.
__rvar
.
set
(
4
)
self
.
__rvar
.
set
(
optiondb
.
get
(
'RSLIDER'
,
4
)
)
self
.
__radio1
=
Checkbutton
(
frame
,
text
=
'Red'
,
variable
=
self
.
__rvar
,
command
=
self
.
__effect
,
onvalue
=
4
,
offvalue
=
0
)
self
.
__radio1
.
grid
(
row
=
1
,
column
=
1
,
sticky
=
W
)
self
.
__gvar
=
IntVar
()
self
.
__gvar
.
set
(
2
)
self
.
__gvar
.
set
(
optiondb
.
get
(
'GSLIDER'
,
2
)
)
self
.
__radio2
=
Checkbutton
(
frame
,
text
=
'Green'
,
variable
=
self
.
__gvar
,
command
=
self
.
__effect
,
onvalue
=
2
,
offvalue
=
0
)
self
.
__radio2
.
grid
(
row
=
2
,
column
=
1
,
sticky
=
W
)
self
.
__bvar
=
IntVar
()
self
.
__bvar
.
set
(
1
)
self
.
__bvar
.
set
(
optiondb
.
get
(
'BSLIDER'
,
1
)
)
self
.
__radio3
=
Checkbutton
(
frame
,
text
=
'Blue'
,
variable
=
self
.
__bvar
,
command
=
self
.
__effect
,
...
...
@@ -115,7 +116,7 @@ class DetailsViewer:
self
.
__l3
=
Label
(
frame
,
text
=
'At boundary:'
)
self
.
__l3
.
grid
(
row
=
5
,
column
=
0
,
sticky
=
E
)
self
.
__boundvar
=
StringVar
()
self
.
__boundvar
.
set
(
STOP
)
self
.
__boundvar
.
set
(
optiondb
.
get
(
'ATBOUND'
,
STOP
)
)
self
.
__omenu
=
OptionMenu
(
frame
,
self
.
__boundvar
,
STOP
,
WRAP
,
RATIO
,
GRAV
)
self
.
__omenu
.
grid
(
row
=
5
,
column
=
1
,
sticky
=
W
)
...
...
@@ -262,3 +263,9 @@ class DetailsViewer:
self
.
__red
=
red
self
.
__green
=
green
self
.
__blue
=
blue
def
save_options
(
self
,
optiondb
):
optiondb
[
'RSLIDER'
]
=
self
.
__rvar
.
get
()
optiondb
[
'GSLIDER'
]
=
self
.
__gvar
.
get
()
optiondb
[
'BSLIDER'
]
=
self
.
__bvar
.
get
()
optiondb
[
'ATBOUND'
]
=
self
.
__boundvar
.
get
()
Tools/pynche/ListViewer.py
Dosyayı görüntüle @
8a09e1cc
...
...
@@ -21,6 +21,7 @@ import ColorDB
class
ListViewer
:
def
__init__
(
self
,
switchboard
,
parent
=
None
):
self
.
__sb
=
switchboard
optiondb
=
switchboard
.
optiondb
()
self
.
__lastbox
=
None
self
.
__dontcenter
=
0
# GUI
...
...
@@ -76,7 +77,7 @@ class ListViewer:
#
# Update on click
self
.
__uoc
=
BooleanVar
()
self
.
__uoc
.
set
(
1
)
self
.
__uoc
.
set
(
optiondb
.
get
(
'UPONCLICK'
,
1
)
)
self
.
__uocbtn
=
Checkbutton
(
root
,
text
=
'Update on Click'
,
variable
=
self
.
__uoc
,
...
...
@@ -160,3 +161,6 @@ class ListViewer:
ig
,
ig
,
ig
,
y2
=
canvas
.
coords
(
self
.
__bboxes
[
-
1
])
h
=
int
(
canvas
[
'height'
])
*
0.5
canvas
.
yview
(
'moveto'
,
(
y1
-
h
)
/
y2
)
def
save_options
(
self
,
optiondb
):
optiondb
[
'UPONCLICK'
]
=
self
.
__uoc
.
get
()
Tools/pynche/Main.py
Dosyayı görüntüle @
8a09e1cc
...
...
@@ -12,13 +12,26 @@ This program currently requires Python 1.5 with Tkinter. It has only been
tested on Solaris 2.6. Feedback is greatly appreciated. Send email to
bwarsaw@python.org
Usage:
%(PROGRAM)
s [-d file] [-h] [initialcolor]
Usage:
%(PROGRAM)
s [-d file] [-
i file] [-X] [-
h] [initialcolor]
Where:
--database file
-d file
Alternate location of a color database file
--initfile file
-i file
Alternate location of the initialization file. This file contains a
persistent database of the current Pynche options and color. This
means that Pynche restores its option settings and current color when
it restarts, using this file (unless the -X option is used). The
default is ~/.pynche
--ignore
-X
Ignore the initialization file when starting up. Pynche will still
write the current option settings to this file when it quits.
--help
-h
print this message
...
...
@@ -49,7 +62,7 @@ RGB_TXT = [
# Solaris OpenWindows
'/usr/openwin/lib/rgb.txt'
,
# The X11R6.4 rgb.txt file
os
.
path
.
join
(
sys
.
path
[
0
],
'rgb.txt'
),
os
.
path
.
join
(
sys
.
path
[
0
],
'
X/
rgb.txt'
),
# add more here
]
...
...
@@ -95,23 +108,29 @@ def main():
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'hd:'
,
[
'database='
,
'help'
])
'hd:
i:X
'
,
[
'database='
,
'
initfile='
,
'ignore'
,
'
help'
])
except
getopt
.
error
,
msg
:
usage
(
1
,
msg
)
if
len
(
args
)
==
0
:
initialcolor
=
'grey50'
initialcolor
=
None
elif
len
(
args
)
==
1
:
initialcolor
=
args
[
0
]
else
:
usage
(
1
)
ignore
=
0
initfile
=
os
.
path
.
expanduser
(
'~/.pynche'
)
for
opt
,
arg
in
opts
:
if
opt
in
(
'-h'
,
'--help'
):
usage
(
0
)
elif
opt
in
(
'-d'
,
'--database'
):
RGB_TXT
.
insert
(
0
,
arg
)
elif
opt
in
(
'-X'
,
'--ignore'
):
ignore
=
1
elif
opt
in
(
'-i'
,
'--initfile'
):
initfile
=
arg
# create the windows and go
for
f
in
RGB_TXT
:
...
...
@@ -124,11 +143,8 @@ def main():
else
:
usage
(
1
,
'No color database file found, see the -d option.'
)
# get the initial color as components
red
,
green
,
blue
=
initial_color
(
initialcolor
,
colordb
)
# create all output widgets
s
=
Switchboard
(
colordb
)
s
=
Switchboard
(
colordb
,
not
ignore
and
initfile
)
# create the application window decorations
app
=
PyncheWidget
(
__version__
,
s
)
...
...
@@ -137,6 +153,20 @@ def main():
s
.
add_view
(
StripViewer
(
s
,
parent
))
s
.
add_view
(
ChipViewer
(
s
,
parent
))
s
.
add_view
(
TypeinViewer
(
s
,
parent
))
# get the initial color as components and set the color on all views. if
# there was no initial color given on the command line, use the one that's
# stored in the option database
if
initialcolor
is
None
:
optiondb
=
s
.
optiondb
()
red
=
optiondb
.
get
(
'RED'
)
green
=
optiondb
.
get
(
'GREEN'
)
blue
=
optiondb
.
get
(
'BLUE'
)
# but if there wasn't any stored in the database, use grey50
if
red
is
None
or
blue
is
None
or
green
is
None
:
red
,
green
,
blue
=
initial_color
(
'grey50'
,
colordb
)
else
:
red
,
green
,
blue
=
initial_color
(
initialcolor
,
colordb
)
s
.
update_views
(
red
,
green
,
blue
)
try
:
...
...
@@ -144,6 +174,9 @@ def main():
except
KeyboardInterrupt
:
pass
# save the option database
s
.
save_views
(
initfile
)
if
__name__
==
'__main__'
:
...
...
Tools/pynche/PyncheWidget.py
Dosyayı görüntüle @
8a09e1cc
...
...
@@ -60,7 +60,7 @@ class PyncheWidget:
# Help menu
#
helpmenu
=
Menu
(
menubar
,
name
=
'help'
,
tearoff
=
0
)
helpmenu
.
add_command
(
label
=
'About...'
,
helpmenu
.
add_command
(
label
=
'About
Pynche
...'
,
command
=
self
.
__popup_about
,
underline
=
0
)
#
...
...
@@ -111,7 +111,7 @@ Color and Hue Editor
Copyright (C) 1998 CNRI
All rights reserved
For information
about Pynche
contact
For information contact
author: Barry A. Warsaw
email : bwarsaw@python.org'''
%
__version__
)
...
...
Tools/pynche/StripViewer.py
Dosyayı görüntüle @
8a09e1cc
...
...
@@ -298,11 +298,14 @@ class StripWidget:
class
StripViewer
:
def
__init__
(
self
,
switchboard
,
parent
=
None
):
self
.
__sb
=
switchboard
optiondb
=
switchboard
.
optiondb
()
# create a frame inside the parent
self
.
__frame
=
Frame
(
parent
)
#, relief=GROOVE, borderwidth=2)
self
.
__frame
.
grid
(
row
=
1
,
column
=
0
,
columnspan
=
2
,
sticky
=
'EW'
)
uwd
=
BooleanVar
()
hexp
=
BooleanVar
()
uwd
=
self
.
__uwdvar
=
BooleanVar
()
uwd
.
set
(
optiondb
.
get
(
'UPWHILEDRAG'
,
0
))
hexp
=
self
.
__hexpvar
=
BooleanVar
()
hexp
.
set
(
optiondb
.
get
(
'HEXSTRIP'
,
0
))
self
.
__reds
=
StripWidget
(
switchboard
,
self
.
__frame
,
generator
=
constant_cyan_generator
,
axis
=
0
,
...
...
@@ -349,3 +352,7 @@ class StripViewer:
def
__togglehex
(
self
,
event
=
None
):
red
,
green
,
blue
=
self
.
__sb
.
current_rgb
()
self
.
update_yourself
(
red
,
green
,
blue
)
def
save_options
(
self
,
optiondb
):
optiondb
[
'UPWHILEDRAG'
]
=
self
.
__uwdvar
.
get
()
optiondb
[
'HEXSTRIP'
]
=
self
.
__hexpvar
.
get
()
Tools/pynche/Switchboard.py
Dosyayı görüntüle @
8a09e1cc
...
...
@@ -12,13 +12,32 @@ conform to the following interface:
since this would cause it to get updated twice.
"""
from
types
import
DictType
import
marshal
class
Switchboard
:
def
__init__
(
self
,
colordb
):
self
.
__views
=
[]
def
__init__
(
self
,
colordb
,
initfile
):
self
.
__colordb
=
colordb
self
.
__optiondb
=
{}
self
.
__views
=
[]
self
.
__red
=
0
self
.
__green
=
0
self
.
__blue
=
0
# read the initialization file
fp
=
None
if
initfile
:
try
:
try
:
fp
=
open
(
initfile
)
self
.
__optiondb
=
marshal
.
load
(
fp
)
if
type
(
self
.
__optiondb
)
<>
DictType
:
print
'Problem reading options from file:'
,
initfile
self
.
__optiondb
=
{}
except
(
IOError
,
EOFError
):
pass
finally
:
if
fp
:
fp
.
close
()
def
add_view
(
self
,
view
):
self
.
__views
.
append
(
view
)
...
...
@@ -38,3 +57,25 @@ class Switchboard:
def
colordb
(
self
):
return
self
.
__colordb
def
optiondb
(
self
):
return
self
.
__optiondb
def
save_views
(
self
,
file
):
# save the current color
self
.
__optiondb
[
'RED'
]
=
self
.
__red
self
.
__optiondb
[
'GREEN'
]
=
self
.
__green
self
.
__optiondb
[
'BLUE'
]
=
self
.
__blue
for
v
in
self
.
__views
:
v
.
save_options
(
self
.
__optiondb
)
fp
=
None
try
:
try
:
fp
=
open
(
file
,
'w'
)
except
IOError
:
print
'Cannot write options to file:'
,
file
else
:
marshal
.
dump
(
self
.
__optiondb
,
fp
)
finally
:
if
fp
:
fp
.
close
()
Tools/pynche/TextViewer.py
Dosyayı görüntüle @
8a09e1cc
...
...
@@ -21,6 +21,7 @@ import ColorDB
class
TextViewer
:
def
__init__
(
self
,
switchboard
,
parent
=
None
):
self
.
__sb
=
switchboard
optiondb
=
switchboard
.
optiondb
()
root
=
self
.
__root
=
Toplevel
(
parent
,
class_
=
'Pynche'
)
root
.
protocol
(
'WM_DELETE_WINDOW'
,
self
.
__withdraw
)
root
.
title
(
'Pynche Text Window'
)
...
...
@@ -33,11 +34,20 @@ class TextViewer:
# create the text widget
#
self
.
__text
=
Text
(
root
,
relief
=
SUNKEN
,
background
=
'black'
,
foreground
=
'white'
,
background
=
optiondb
.
get
(
'TEXTBG'
,
'black'
)
,
foreground
=
optiondb
.
get
(
'TEXTFG'
,
'white'
)
,
width
=
35
,
height
=
15
)
sfg
=
optiondb
.
get
(
'TEXT_SFG'
)
if
sfg
:
self
.
__text
.
configure
(
selectforeground
=
sfg
)
sbg
=
optiondb
.
get
(
'TEXT_SBG'
)
if
sbg
:
self
.
__text
.
configure
(
selectbackground
=
sbg
)
ibg
=
optiondb
.
get
(
'TEXT_IBG'
)
if
ibg
:
self
.
__text
.
configure
(
insertbackground
=
ibg
)
self
.
__text
.
pack
()
self
.
__text
.
insert
(
0.0
,
'''
\
self
.
__text
.
insert
(
0.0
,
optiondb
.
get
(
'TEXT'
,
'''
\
Insert some stuff here and play
with the buttons below to see
how the colors interact in
...
...
@@ -45,14 +55,23 @@ textual displays.
See how the selection can also
be affected by tickling the buttons
and choosing a color.'''
)
self
.
__text
.
tag_add
(
SEL
,
6.0
,
END
)
and choosing a color.'''
))
insert
=
optiondb
.
get
(
'TEXTINS'
)
if
insert
:
self
.
__text
.
mark_set
(
INSERT
,
insert
)
try
:
start
,
end
=
optiondb
.
get
(
'TEXTSEL'
,
(
6.0
,
END
))
self
.
__text
.
tag_add
(
SEL
,
start
,
end
)
except
ValueError
:
# selection wasn't set
pass
self
.
__text
.
focus_set
()
#
# variables
self
.
__trackp
=
BooleanVar
()
self
.
__trackp
.
set
(
0
)
self
.
__trackp
.
set
(
optiondb
.
get
(
'TRACKP'
,
0
)
)
self
.
__which
=
IntVar
()
self
.
__which
.
set
(
0
)
self
.
__which
.
set
(
optiondb
.
get
(
'WHICH'
,
0
)
)
#
# track toggle
self
.
__t
=
Checkbutton
(
root
,
text
=
'Track color changes'
,
...
...
@@ -130,3 +149,15 @@ and choosing a color.''')
self
.
__text
.
configure
(
selectbackground
=
colorname
)
elif
which
==
5
:
self
.
__text
.
configure
(
insertbackground
=
colorname
)
def
save_options
(
self
,
optiondb
):
optiondb
[
'TRACKP'
]
=
self
.
__trackp
.
get
()
optiondb
[
'WHICH'
]
=
self
.
__which
.
get
()
optiondb
[
'TEXT'
]
=
self
.
__text
.
get
(
0.0
,
'end - 1c'
)
optiondb
[
'TEXTSEL'
]
=
self
.
__text
.
tag_ranges
(
SEL
)[
0
:
2
]
optiondb
[
'TEXTINS'
]
=
self
.
__text
.
index
(
INSERT
)
optiondb
[
'TEXTFG'
]
=
self
.
__text
[
'foreground'
]
optiondb
[
'TEXTBG'
]
=
self
.
__text
[
'background'
]
optiondb
[
'TEXT_SFG'
]
=
self
.
__text
[
'selectforeground'
]
optiondb
[
'TEXT_SBG'
]
=
self
.
__text
[
'selectbackground'
]
optiondb
[
'TEXT_IBG'
]
=
self
.
__text
[
'insertbackground'
]
Tools/pynche/TypeinViewer.py
Dosyayı görüntüle @
8a09e1cc
...
...
@@ -20,8 +20,11 @@ class TypeinViewer:
def
__init__
(
self
,
switchboard
,
parent
=
None
):
# non-gui ivars
self
.
__sb
=
switchboard
optiondb
=
switchboard
.
optiondb
()
self
.
__hexp
=
BooleanVar
()
self
.
__hexp
.
set
(
optiondb
.
get
(
'HEXTYPE'
,
0
))
self
.
__uwtyping
=
BooleanVar
()
self
.
__uwtyping
.
set
(
optiondb
.
get
(
'UPWHILETYPE'
,
0
))
# create the gui
self
.
__frame
=
Frame
(
parent
)
#, relief=GROOVE, borderwidth=2)
self
.
__frame
.
grid
(
row
=
3
,
column
=
1
,
sticky
=
'NS'
)
...
...
@@ -130,3 +133,7 @@ class TypeinViewer:
def
hexp_var
(
self
):
return
self
.
__hexp
def
save_options
(
self
,
optiondb
):
optiondb
[
'HEXTYPE'
]
=
self
.
__hexp
.
get
()
optiondb
[
'UPWHILETYPE'
]
=
self
.
__uwtyping
.
get
()
Tools/pynche/__init__.py
0 → 100644
Dosyayı görüntüle @
8a09e1cc
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