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
bf76ce16
Commit
bf76ce16
authored
Aug 02, 2010
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the Pynche tool work with Python 3.
parent
18009342
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
32 additions
and
28 deletions
+32
-28
Tools/pynche/ChipViewer.py
Tools/pynche/ChipViewer.py
+1
-1
Tools/pynche/DetailsViewer.py
Tools/pynche/DetailsViewer.py
+1
-1
Tools/pynche/ListViewer.py
Tools/pynche/ListViewer.py
+1
-1
Tools/pynche/PyncheWidget.py
Tools/pynche/PyncheWidget.py
+13
-9
Tools/pynche/StripViewer.py
Tools/pynche/StripViewer.py
+9
-9
Tools/pynche/Switchboard.py
Tools/pynche/Switchboard.py
+5
-5
Tools/pynche/TextViewer.py
Tools/pynche/TextViewer.py
+1
-1
Tools/pynche/TypeinViewer.py
Tools/pynche/TypeinViewer.py
+1
-1
No files found.
Tools/pynche/ChipViewer.py
View file @
bf76ce16
...
@@ -13,7 +13,7 @@ The ChipViewer class includes the entire lower left quandrant; i.e. both the
...
@@ -13,7 +13,7 @@ The ChipViewer class includes the entire lower left quandrant; i.e. both the
selected and nearest ChipWidgets.
selected and nearest ChipWidgets.
"""
"""
from
T
kinter
import
*
from
t
kinter
import
*
import
ColorDB
import
ColorDB
...
...
Tools/pynche/DetailsViewer.py
View file @
bf76ce16
...
@@ -52,7 +52,7 @@ Shift + Left == -25
...
@@ -52,7 +52,7 @@ Shift + Left == -25
Shift + Right == +25
Shift + Right == +25
"""
"""
from
T
kinter
import
*
from
t
kinter
import
*
STOP
=
'Stop'
STOP
=
'Stop'
WRAP
=
'Wrap Around'
WRAP
=
'Wrap Around'
...
...
Tools/pynche/ListViewer.py
View file @
bf76ce16
...
@@ -15,7 +15,7 @@ You can turn off Update On Click if all you want to see is the alias for a
...
@@ -15,7 +15,7 @@ You can turn off Update On Click if all you want to see is the alias for a
given name, without selecting the color.
given name, without selecting the color.
"""
"""
from
T
kinter
import
*
from
t
kinter
import
*
import
ColorDB
import
ColorDB
ADDTOVIEW
=
'Color %List Window...'
ADDTOVIEW
=
'Color %List Window...'
...
...
Tools/pynche/PyncheWidget.py
View file @
bf76ce16
...
@@ -6,9 +6,8 @@ It is used to bring up other windows.
...
@@ -6,9 +6,8 @@ It is used to bring up other windows.
import
sys
import
sys
import
os
import
os
from
Tkinter
import
*
from
tkinter
import
*
import
tkMessageBox
from
tkinter
import
messagebox
,
filedialog
import
tkFileDialog
import
ColorDB
import
ColorDB
# Milliseconds between interrupt checks
# Milliseconds between interrupt checks
...
@@ -150,7 +149,7 @@ class PyncheWidget:
...
@@ -150,7 +149,7 @@ class PyncheWidget:
def
__popup_about
(
self
,
event
=
None
):
def
__popup_about
(
self
,
event
=
None
):
from
Main
import
__version__
from
Main
import
__version__
tkMessageB
ox
.
showinfo
(
'About Pynche '
+
__version__
,
messageb
ox
.
showinfo
(
'About Pynche '
+
__version__
,
'''
\
'''
\
Pynche %s
Pynche %s
The PYthonically Natural
The PYthonically Natural
...
@@ -168,7 +167,7 @@ email: bwarsaw@python.org''' % __version__)
...
@@ -168,7 +167,7 @@ email: bwarsaw@python.org''' % __version__)
def
__load
(
self
,
event
=
None
):
def
__load
(
self
,
event
=
None
):
while
1
:
while
1
:
idir
,
ifile
=
os
.
path
.
split
(
self
.
__sb
.
colordb
().
filename
())
idir
,
ifile
=
os
.
path
.
split
(
self
.
__sb
.
colordb
().
filename
())
file
=
tkFileD
ialog
.
askopenfilename
(
file
=
filed
ialog
.
askopenfilename
(
filetypes
=
[(
'Text files'
,
'*.txt'
),
filetypes
=
[(
'Text files'
,
'*.txt'
),
(
'All files'
,
'*'
),
(
'All files'
,
'*'
),
],
],
...
@@ -180,12 +179,12 @@ email: bwarsaw@python.org''' % __version__)
...
@@ -180,12 +179,12 @@ email: bwarsaw@python.org''' % __version__)
try
:
try
:
colordb
=
ColorDB
.
get_colordb
(
file
)
colordb
=
ColorDB
.
get_colordb
(
file
)
except
IOError
:
except
IOError
:
tkMessageB
ox
.
showerror
(
'Read error'
,
'''
\
messageb
ox
.
showerror
(
'Read error'
,
'''
\
Could not open file for reading:
Could not open file for reading:
%s'''
%
file
)
%s'''
%
file
)
continue
continue
if
colordb
is
None
:
if
colordb
is
None
:
tkMessageB
ox
.
showerror
(
'Unrecognized color file type'
,
'''
\
messageb
ox
.
showerror
(
'Unrecognized color file type'
,
'''
\
Unrecognized color file type in file:
Unrecognized color file type in file:
%s'''
%
file
)
%s'''
%
file
)
continue
continue
...
@@ -249,6 +248,8 @@ class Helpwin:
...
@@ -249,6 +248,8 @@ class Helpwin:
import
functools
@
functools
.
total_ordering
class
PopupViewer
:
class
PopupViewer
:
def
__init__
(
self
,
module
,
name
,
switchboard
,
root
):
def
__init__
(
self
,
module
,
name
,
switchboard
,
root
):
self
.
__m
=
module
self
.
__m
=
module
...
@@ -279,8 +280,11 @@ class PopupViewer:
...
@@ -279,8 +280,11 @@ class PopupViewer:
self
.
__sb
.
add_view
(
self
.
__window
)
self
.
__sb
.
add_view
(
self
.
__window
)
self
.
__window
.
deiconify
()
self
.
__window
.
deiconify
()
def
__cmp__
(
self
,
other
):
def
__eq__
(
self
,
other
):
return
cmp
(
self
.
__menutext
,
other
.
__menutext
)
return
self
.
__menutext
==
other
.
__menutext
def
__lt__
(
self
,
other
):
return
self
.
__menutext
<
other
.
__menutext
def
make_view_popups
(
switchboard
,
root
,
extrapath
):
def
make_view_popups
(
switchboard
,
root
,
extrapath
):
...
...
Tools/pynche/StripViewer.py
View file @
bf76ce16
...
@@ -24,7 +24,7 @@ select the color under the cursor while you drag it, but be forewarned that
...
@@ -24,7 +24,7 @@ select the color under the cursor while you drag it, but be forewarned that
this can be slow.
this can be slow.
"""
"""
from
T
kinter
import
*
from
t
kinter
import
*
import
ColorDB
import
ColorDB
# Load this script into the Tcl interpreter and call it in
# Load this script into the Tcl interpreter and call it in
...
@@ -62,32 +62,32 @@ def constant(numchips):
...
@@ -62,32 +62,32 @@ def constant(numchips):
# red variations, green+blue = cyan constant
# red variations, green+blue = cyan constant
def
constant_red_generator
(
numchips
,
red
,
green
,
blue
):
def
constant_red_generator
(
numchips
,
red
,
green
,
blue
):
seq
=
constant
(
numchips
)
seq
=
constant
(
numchips
)
return
list
(
map
(
None
,
[
red
]
*
numchips
,
seq
,
seq
))
return
list
(
zip
(
[
red
]
*
numchips
,
seq
,
seq
))
# green variations, red+blue = magenta constant
# green variations, red+blue = magenta constant
def
constant_green_generator
(
numchips
,
red
,
green
,
blue
):
def
constant_green_generator
(
numchips
,
red
,
green
,
blue
):
seq
=
constant
(
numchips
)
seq
=
constant
(
numchips
)
return
list
(
map
(
None
,
seq
,
[
green
]
*
numchips
,
seq
))
return
list
(
zip
(
seq
,
[
green
]
*
numchips
,
seq
))
# blue variations, red+green = yellow constant
# blue variations, red+green = yellow constant
def
constant_blue_generator
(
numchips
,
red
,
green
,
blue
):
def
constant_blue_generator
(
numchips
,
red
,
green
,
blue
):
seq
=
constant
(
numchips
)
seq
=
constant
(
numchips
)
return
list
(
map
(
None
,
seq
,
seq
,
[
blue
]
*
numchips
))
return
list
(
zip
(
seq
,
seq
,
[
blue
]
*
numchips
))
# red variations, green+blue = cyan constant
# red variations, green+blue = cyan constant
def
constant_cyan_generator
(
numchips
,
red
,
green
,
blue
):
def
constant_cyan_generator
(
numchips
,
red
,
green
,
blue
):
seq
=
constant
(
numchips
)
seq
=
constant
(
numchips
)
return
list
(
map
(
None
,
seq
,
[
green
]
*
numchips
,
[
blue
]
*
numchips
))
return
list
(
zip
(
seq
,
[
green
]
*
numchips
,
[
blue
]
*
numchips
))
# green variations, red+blue = magenta constant
# green variations, red+blue = magenta constant
def
constant_magenta_generator
(
numchips
,
red
,
green
,
blue
):
def
constant_magenta_generator
(
numchips
,
red
,
green
,
blue
):
seq
=
constant
(
numchips
)
seq
=
constant
(
numchips
)
return
list
(
map
(
None
,
[
red
]
*
numchips
,
seq
,
[
blue
]
*
numchips
))
return
list
(
zip
(
[
red
]
*
numchips
,
seq
,
[
blue
]
*
numchips
))
# blue variations, red+green = yellow constant
# blue variations, red+green = yellow constant
def
constant_yellow_generator
(
numchips
,
red
,
green
,
blue
):
def
constant_yellow_generator
(
numchips
,
red
,
green
,
blue
):
seq
=
constant
(
numchips
)
seq
=
constant
(
numchips
)
return
list
(
map
(
None
,
[
red
]
*
numchips
,
[
green
]
*
numchips
,
seq
))
return
list
(
zip
(
[
red
]
*
numchips
,
[
green
]
*
numchips
,
seq
))
...
@@ -119,7 +119,7 @@ class LeftArrow:
...
@@ -119,7 +119,7 @@ class LeftArrow:
return
arrow
,
text
return
arrow
,
text
def
_x
(
self
):
def
_x
(
self
):
coords
=
self
.
_canvas
.
coords
(
self
.
_TAG
)
coords
=
list
(
self
.
_canvas
.
coords
(
self
.
_TAG
)
)
assert
coords
assert
coords
return
coords
[
0
]
return
coords
[
0
]
...
@@ -151,7 +151,7 @@ class RightArrow(LeftArrow):
...
@@ -151,7 +151,7 @@ class RightArrow(LeftArrow):
return
arrow
,
text
return
arrow
,
text
def
_x
(
self
):
def
_x
(
self
):
coords
=
self
.
_canvas
.
coords
(
self
.
_TAG
)
coords
=
list
(
self
.
_canvas
.
coords
(
self
.
_TAG
)
)
assert
coords
assert
coords
return
coords
[
0
]
+
self
.
_ARROWWIDTH
return
coords
[
0
]
+
self
.
_ARROWWIDTH
...
...
Tools/pynche/Switchboard.py
View file @
bf76ce16
...
@@ -42,7 +42,6 @@ master window.
...
@@ -42,7 +42,6 @@ master window.
"""
"""
import
sys
import
sys
from
types
import
DictType
import
marshal
import
marshal
...
@@ -62,10 +61,11 @@ class Switchboard:
...
@@ -62,10 +61,11 @@ class Switchboard:
if
initfile
:
if
initfile
:
try
:
try
:
try
:
try
:
fp
=
open
(
initfile
)
fp
=
open
(
initfile
,
'rb'
)
self
.
__optiondb
=
marshal
.
load
(
fp
)
self
.
__optiondb
=
marshal
.
load
(
fp
)
if
not
isinstance
(
self
.
__optiondb
,
DictType
):
if
not
isinstance
(
self
.
__optiondb
,
dict
):
print
(
'Problem reading options from file:'
,
initfile
,
file
=
sys
.
stderr
)
print
(
'Problem reading options from file:'
,
initfile
,
file
=
sys
.
stderr
)
self
.
__optiondb
=
{}
self
.
__optiondb
=
{}
except
(
IOError
,
EOFError
,
ValueError
):
except
(
IOError
,
EOFError
,
ValueError
):
pass
pass
...
@@ -116,7 +116,7 @@ class Switchboard:
...
@@ -116,7 +116,7 @@ class Switchboard:
fp
=
None
fp
=
None
try
:
try
:
try
:
try
:
fp
=
open
(
self
.
__initfile
,
'w'
)
fp
=
open
(
self
.
__initfile
,
'w
b
'
)
except
IOError
:
except
IOError
:
print
(
'Cannot write options to file:'
,
\
print
(
'Cannot write options to file:'
,
\
self
.
__initfile
,
file
=
sys
.
stderr
)
self
.
__initfile
,
file
=
sys
.
stderr
)
...
...
Tools/pynche/TextViewer.py
View file @
bf76ce16
...
@@ -15,7 +15,7 @@ button and drag it through some text. The Insertion is the insertion cursor
...
@@ -15,7 +15,7 @@ button and drag it through some text. The Insertion is the insertion cursor
in the text window (which only has a background).
in the text window (which only has a background).
"""
"""
from
T
kinter
import
*
from
t
kinter
import
*
import
ColorDB
import
ColorDB
ADDTOVIEW
=
'Text Window...'
ADDTOVIEW
=
'Text Window...'
...
...
Tools/pynche/TypeinViewer.py
View file @
bf76ce16
...
@@ -12,7 +12,7 @@ color selection will be made on every change to the text field. Otherwise,
...
@@ -12,7 +12,7 @@ color selection will be made on every change to the text field. Otherwise,
you must hit Return or Tab to select the color.
you must hit Return or Tab to select the color.
"""
"""
from
T
kinter
import
*
from
t
kinter
import
*
...
...
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