summaryrefslogtreecommitdiffstats
path: root/Mac/Contrib/PyIDE-src/Scripts
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1998-08-18 14:59:10 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1998-08-18 14:59:10 (GMT)
commitcb5704e6a8f4a97d9fc5554df83fa88d058287b9 (patch)
treea2b6032cccb6d4ba130b07fa415d64d613d76e0c /Mac/Contrib/PyIDE-src/Scripts
parent7cc5735ef26a60df9d1bc3554c1912f951a90308 (diff)
downloadcpython-cb5704e6a8f4a97d9fc5554df83fa88d058287b9.zip
cpython-cb5704e6a8f4a97d9fc5554df83fa88d058287b9.tar.gz
cpython-cb5704e6a8f4a97d9fc5554df83fa88d058287b9.tar.bz2
Initial revision
Diffstat (limited to 'Mac/Contrib/PyIDE-src/Scripts')
-rw-r--r--Mac/Contrib/PyIDE-src/Scripts/ Hold option to open a scriptŠ4
-rw-r--r--Mac/Contrib/PyIDE-src/Scripts/ separator ---1
-rw-r--r--Mac/Contrib/PyIDE-src/Scripts/Hack/Remove .pyc filesŠ20
-rw-r--r--Mac/Contrib/PyIDE-src/Scripts/Hack/Toolbox AssistantŠ53
-rw-r--r--Mac/Contrib/PyIDE-src/Scripts/Insert0
-rw-r--r--Mac/Contrib/PyIDE-src/Scripts/Insert file nameŠ6
-rw-r--r--Mac/Contrib/PyIDE-src/Scripts/Insert folder nameŠ6
7 files changed, 90 insertions, 0 deletions
diff --git a/Mac/Contrib/PyIDE-src/Scripts/ Hold option to open a scriptŠ b/Mac/Contrib/PyIDE-src/Scripts/ Hold option to open a scriptŠ
new file mode 100644
index 0000000..062c64c
--- /dev/null
+++ b/Mac/Contrib/PyIDE-src/Scripts/ Hold option to open a scriptŠ
@@ -0,0 +1,4 @@
+"Hold the option key to open a script instead of running it."
+
+import W
+W.Message(__doc__)
diff --git a/Mac/Contrib/PyIDE-src/Scripts/ separator --- b/Mac/Contrib/PyIDE-src/Scripts/ separator ---
new file mode 100644
index 0000000..a24dcd7
--- /dev/null
+++ b/Mac/Contrib/PyIDE-src/Scripts/ separator ---
@@ -0,0 +1 @@
+A separator ends with '---'
diff --git a/Mac/Contrib/PyIDE-src/Scripts/Hack/Remove .pyc filesŠ b/Mac/Contrib/PyIDE-src/Scripts/Hack/Remove .pyc filesŠ
new file mode 100644
index 0000000..80f52d5
--- /dev/null
+++ b/Mac/Contrib/PyIDE-src/Scripts/Hack/Remove .pyc filesŠ
@@ -0,0 +1,20 @@
+import sys
+import os
+import macfs
+
+def walk(top):
+ names = os.listdir(top)
+ for name in names:
+ path = os.path.join(top, name)
+ if os.path.isdir(path):
+ walk(path)
+ else:
+ if path[-4:] == '.pyc' and os.path.exists(path[:-1]):
+ print "deleting:", path
+ os.remove(path)
+ elif path[-4:] == '.pyc':
+ print "!!! ------ .pyc file without .py file:", path
+
+fss, ok = macfs.GetDirectory('Select the starting folder:')
+if ok:
+ walk(fss.as_pathname())
diff --git a/Mac/Contrib/PyIDE-src/Scripts/Hack/Toolbox AssistantŠ b/Mac/Contrib/PyIDE-src/Scripts/Hack/Toolbox AssistantŠ
new file mode 100644
index 0000000..e55c00a
--- /dev/null
+++ b/Mac/Contrib/PyIDE-src/Scripts/Hack/Toolbox AssistantŠ
@@ -0,0 +1,53 @@
+import aetools
+import Standard_Suite
+import Required_Suite
+import MacOS
+import W
+
+
+class Toolbox(aetools.TalkTo, Standard_Suite.Standard_Suite):
+
+ def LookupTopic(self, _object, _attributes={}, **_arguments):
+ _code = 'DanR'
+ _subcode = 'REF '
+
+ #aetools.keysubst(_arguments, self._argmap_OpenURL)
+ _arguments['----'] = _object
+
+
+ _reply, _arguments, _attributes = self.send(_code, _subcode,
+ _arguments, _attributes)
+ if _arguments.has_key('errn'):
+ raise MacOS.Error, aetools.decodeerror(_arguments)
+ # XXXX Optionally decode result
+ if _arguments.has_key('----'):
+ return _arguments['----']
+
+
+class ToolboxAssi:
+
+ def __init__(self):
+ self.talker = Toolbox('ALTV')
+ self.w = W.Window((200, 100), "Toolbox Assistant")
+ self.w.button = W.Button((-94, -32, 80, 16), "Lookup", self.lookup)
+ self.w.prompt = W.TextBox((10, 8, -10, 15), "Enter topic:")
+ self.w.edit = W.EditText((10, 24, -10, 20))
+ self.w.setdefaultbutton(self.w.button)
+ self.w.open()
+
+ def lookup(self):
+ lookup = self.w.edit.get()
+ try:
+ self.talker.LookupTopic(lookup)
+ except MacOS.Error, detail:
+ if type(detail) == type(()):
+ if detail[0] == -609:
+ self.talker.start()
+ try:
+ self.talker.LookupTopic(lookup)
+ return
+ except MacOS.Error:
+ pass
+ W.Message("Requested topic not found.")
+
+ToolboxAssi()
diff --git a/Mac/Contrib/PyIDE-src/Scripts/Insert b/Mac/Contrib/PyIDE-src/Scripts/Insert
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Mac/Contrib/PyIDE-src/Scripts/Insert
diff --git a/Mac/Contrib/PyIDE-src/Scripts/Insert file nameŠ b/Mac/Contrib/PyIDE-src/Scripts/Insert file nameŠ
new file mode 100644
index 0000000..7632f8e
--- /dev/null
+++ b/Mac/Contrib/PyIDE-src/Scripts/Insert file nameŠ
@@ -0,0 +1,6 @@
+import macfs
+
+fss, ok = macfs.StandardGetFile()
+if ok:
+ import W
+ W.FrontWindowInsert('"%s"' % fss.as_pathname())
diff --git a/Mac/Contrib/PyIDE-src/Scripts/Insert folder nameŠ b/Mac/Contrib/PyIDE-src/Scripts/Insert folder nameŠ
new file mode 100644
index 0000000..1a9e06b
--- /dev/null
+++ b/Mac/Contrib/PyIDE-src/Scripts/Insert folder nameŠ
@@ -0,0 +1,6 @@
+import macfs
+
+fss, ok = macfs.GetDirectory()
+if ok:
+ import W
+ W.FrontWindowInsert('"%s"' % fss.as_pathname())