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
552ac179
Commit
552ac179
authored
Feb 17, 1998
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added about dialog
parent
e2f194b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
4 deletions
+60
-4
Tools/pynche/PyncheWidget.py
Tools/pynche/PyncheWidget.py
+60
-4
No files found.
Tools/pynche/PyncheWidget.py
View file @
552ac179
...
...
@@ -8,6 +8,15 @@ from ChipWidget import ChipWidget
from
TypeinWidget
import
TypeinWidget
from
StripWidget
import
StripWidget
ABOUTTEXT
=
'''Pynche 1.0 -- The Pythonically Natural Color and Hue Editor
Copyright (C) 1998 Barry A. Warsaw
Pynche is based on ICE 1.2 (Interactive Color Editor), written by
Barry A. Warsaw for the SunView window system in 1987.'''
def
constant
(
numchips
):
step
=
255.0
/
(
numchips
-
1
)
...
...
@@ -42,6 +51,8 @@ def constant_yellow_generator(numchips, rgbtuple):
class
PyncheWidget
(
Pmw
.
MegaWidget
):
def
__init__
(
self
,
colordb
,
parent
=
None
,
**
kw
):
self
.
__colordb
=
colordb
self
.
__parent
=
parent
self
.
__about
=
None
options
=
((
'color'
,
(
128
,
128
,
128
),
self
.
__set_color
),
(
'delegate'
,
None
,
None
),
...
...
@@ -50,7 +61,28 @@ class PyncheWidget(Pmw.MegaWidget):
# initialize base class -- after defining options
Pmw
.
MegaWidget
.
__init__
(
self
,
parent
)
interiorarg
=
(
self
.
interior
(),)
# create menubar
self
.
__menubar
=
Pmw
.
MenuBar
(
parent
,
hull_relief
=
RAISED
,
hull_borderwidth
=
1
)
self
.
__menubar
.
pack
(
side
=
TOP
,
expand
=
YES
,
fill
=
BOTH
)
self
.
__menubar
.
addmenu
(
'File'
,
None
)
self
.
__menubar
.
addmenuitem
(
'File'
,
type
=
COMMAND
,
label
=
'Quit'
,
command
=
self
.
__quit
,
accelerator
=
'Alt-Q'
)
self
.
__menubar
.
addmenu
(
'Help'
,
None
,
side
=
RIGHT
)
self
.
__menubar
.
addmenuitem
(
'Help'
,
type
=
COMMAND
,
label
=
'About...'
,
command
=
self
.
__popup_about
,
accelerator
=
'Alt-A'
)
parent
.
bind
(
'<Alt-q>'
,
self
.
__quit
)
parent
.
bind
(
'<Alt-Q>'
,
self
.
__quit
)
parent
.
bind
(
'<Alt-a>'
,
self
.
__popup_about
)
parent
.
bind
(
'<Alt-A>'
,
self
.
__popup_about
)
# create color selectors
group
=
Pmw
.
Group
(
parent
,
tag_text
=
'Variations'
)
...
...
@@ -77,8 +109,12 @@ class PyncheWidget(Pmw.MegaWidget):
self
.
__nearest
=
ChipWidget
(
group
.
interior
(),
label_text
=
'Nearest'
)
self
.
__nearest
.
grid
(
row
=
0
,
column
=
1
)
chip
=
self
.
__nearest
.
component
(
'chip'
)
chip
.
bind
(
'<ButtonRelease-1>'
,
self
.
__set_color_to_chip
)
# TBD: this is somewhat bogus, as the code should be in a derived
# class of ChipWidget.
self
.
__chip
=
self
.
__nearest
.
component
(
'chip'
)
self
.
__chip
.
bind
(
'<ButtonPress-1>'
,
self
.
__buttonpress
)
self
.
__chip
.
bind
(
'<ButtonRelease-1>'
,
self
.
__buttonrelease
)
# create the options window
self
.
__typein
=
TypeinWidget
(
group
.
interior
())
...
...
@@ -125,7 +161,27 @@ class PyncheWidget(Pmw.MegaWidget):
def
__set_color
(
self
):
self
.
set_color
(
self
,
self
[
'color'
])
def
__set_color_to_chip
(
self
,
event
=
None
):
def
__buttonpress
(
self
,
event
=
None
):
self
.
__chip
.
configure
(
relief
=
SUNKEN
)
def
__buttonrelease
(
self
,
event
=
None
):
self
.
__chip
.
configure
(
relief
=
RAISED
)
color
=
self
.
__nearest
[
'color'
]
rgbtuple
=
self
.
__colordb
.
find_byname
(
color
)
self
.
set_color
(
self
,
rgbtuple
)
def
__quit
(
self
,
event
=
None
):
self
.
__parent
.
quit
()
def
__popup_about
(
self
,
event
=
None
):
if
not
self
.
__about
:
Pmw
.
aboutversion
(
'1.0'
)
Pmw
.
aboutcopyright
(
'Copyright (C) 1998 Barry A. Warsaw
\
n
'
'All rights reserved'
)
Pmw
.
aboutcontact
(
'For information about Pynche contact:
\
n
'
'Barry A. Warsaw
\
n
'
'email: bwarsaw@python.org'
)
self
.
__about
=
Pmw
.
AboutDialog
(
applicationname
=
'Pynche -- the PYthonically Natural
\
n
'
'Color and Hue Editor'
)
self
.
__about
.
show
()
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