summaryrefslogtreecommitdiffstats
path: root/Mac/Demo
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/Demo')
-rw-r--r--Mac/Demo/PICTbrowse/ICONbrowse.py10
-rw-r--r--Mac/Demo/PICTbrowse/PICTbrowse.py10
-rw-r--r--Mac/Demo/PICTbrowse/PICTbrowse2.py10
-rw-r--r--Mac/Demo/PICTbrowse/cicnbrowse.py14
-rw-r--r--Mac/Demo/PICTbrowse/oldPICTbrowse.py10
-rw-r--r--Mac/Demo/example1/dnslookup-1.py10
-rw-r--r--Mac/Demo/example2/dnslookup-2.py10
7 files changed, 17 insertions, 57 deletions
diff --git a/Mac/Demo/PICTbrowse/ICONbrowse.py b/Mac/Demo/PICTbrowse/ICONbrowse.py
index 162fcb6..902b5c7 100644
--- a/Mac/Demo/PICTbrowse/ICONbrowse.py
+++ b/Mac/Demo/PICTbrowse/ICONbrowse.py
@@ -10,6 +10,7 @@ from Carbon import List
import sys
import struct
from Carbon import Icn
+import macresource
#
# Resource definitions
@@ -26,14 +27,7 @@ MAXWIDTH=320
MAXHEIGHT=320
def main():
- try:
- dummy = Res.GetResource('DLOG', ID_MAIN)
- except Res.Error:
- try:
- Res.FSpOpenResFile("PICTbrowse.rsrc", 1)
- except Res.Error, arg:
- EasyDialogs.Message("Cannot open PICTbrowse.rsrc: "+arg[1])
- sys.exit(1)
+ macresource.need('DLOG', ID_MAIN, "PICTbrowse.rsrc")
ICONbrowse()
class ICONbrowse(FrameWork.Application):
diff --git a/Mac/Demo/PICTbrowse/PICTbrowse.py b/Mac/Demo/PICTbrowse/PICTbrowse.py
index e45b18c..41ffa5c 100644
--- a/Mac/Demo/PICTbrowse/PICTbrowse.py
+++ b/Mac/Demo/PICTbrowse/PICTbrowse.py
@@ -9,6 +9,7 @@ from Carbon import Controls
from Carbon import List
import sys
import struct
+import macresource
#
# Resource definitions
@@ -21,14 +22,7 @@ LEFT=200
TOP=64
def main():
- try:
- dummy = Res.GetResource('DLOG', ID_MAIN)
- except Res.Error:
- try:
- Res.FSpOpenResFile("PICTbrowse.rsrc", 1)
- except Res.Error, arg:
- EasyDialogs.Message("Cannot open PICTbrowse.rsrc: "+arg[1])
- sys.exit(1)
+ macresource.need('DLOG', ID_MAIN, "PICTbrowse.rsrc")
PICTbrowse()
class PICTbrowse(FrameWork.Application):
diff --git a/Mac/Demo/PICTbrowse/PICTbrowse2.py b/Mac/Demo/PICTbrowse/PICTbrowse2.py
index 7e146ed..0e11681 100644
--- a/Mac/Demo/PICTbrowse/PICTbrowse2.py
+++ b/Mac/Demo/PICTbrowse/PICTbrowse2.py
@@ -9,6 +9,7 @@ from Carbon import Controls
from Carbon import List
import sys
import struct
+import macresource
#
# Resource definitions
@@ -25,14 +26,7 @@ MAXWIDTH=320
MAXHEIGHT=320
def main():
- try:
- dummy = Res.GetResource('DLOG', ID_MAIN)
- except Res.Error:
- try:
- Res.FSpOpenResFile("PICTbrowse.rsrc", 1)
- except Res.Error, arg:
- EasyDialogs.Message("Cannot open PICTbrowse.rsrc: "+arg[1])
- sys.exit(1)
+ macresource.need('DLOG', ID_MAIN, "PICTbrowse.rsrc")
PICTbrowse()
class PICTbrowse(FrameWork.Application):
diff --git a/Mac/Demo/PICTbrowse/cicnbrowse.py b/Mac/Demo/PICTbrowse/cicnbrowse.py
index 89f8218..561dcf9 100644
--- a/Mac/Demo/PICTbrowse/cicnbrowse.py
+++ b/Mac/Demo/PICTbrowse/cicnbrowse.py
@@ -10,6 +10,7 @@ from Carbon import List
import sys
import struct
from Carbon import Icn
+import macresource
#
# Resource definitions
@@ -26,14 +27,7 @@ MAXWIDTH=320
MAXHEIGHT=320
def main():
- try:
- dummy = Res.GetResource('DLOG', ID_MAIN)
- except Res.Error:
- try:
- Res.FSpOpenResFile("PICTbrowse.rsrc", 1)
- except Res.Error, arg:
- EasyDialogs.Message("Cannot open PICTbrowse.rsrc: "+arg[1])
- sys.exit(1)
+ macresource.need('DLOG', ID_MAIN, "PICTbrowse.rsrc")
CIconbrowse()
class CIconbrowse(FrameWork.Application):
@@ -119,9 +113,9 @@ class MyDialog(FrameWork.DialogWindow):
def open(self, id, contents):
self.id = id
FrameWork.DialogWindow.open(self, ID_MAIN)
- self.wid.SetDialogDefaultItem(MAIN_SHOW)
+ self.dlg.SetDialogDefaultItem(MAIN_SHOW)
self.contents = contents
- self.ctl = self.wid.GetDialogItemAsControl(MAIN_LIST)
+ self.ctl = self.dlg.GetDialogItemAsControl(MAIN_LIST)
h = self.ctl.GetControlData_Handle(Controls.kControlListBoxPart,
Controls.kControlListBoxListHandleTag)
self.list = List.as_List(h)
diff --git a/Mac/Demo/PICTbrowse/oldPICTbrowse.py b/Mac/Demo/PICTbrowse/oldPICTbrowse.py
index 01cf71c..dc1f5b4 100644
--- a/Mac/Demo/PICTbrowse/oldPICTbrowse.py
+++ b/Mac/Demo/PICTbrowse/oldPICTbrowse.py
@@ -8,6 +8,7 @@ from Carbon import Win
from Carbon import List
import sys
import struct
+import macresource
#
# Resource definitions
@@ -20,14 +21,7 @@ LEFT=200
TOP=64
def main():
- try:
- dummy = Res.GetResource('DLOG', ID_MAIN)
- except Res.Error:
- try:
- Res.FSpOpenResFile("oldPICTbrowse.rsrc", 0)
- except Res.Error, arg:
- EasyDialogs.Message("Cannot open PICTbrowse.rsrc: "+arg[1])
- sys.exit(1)
+ macresource.need('DLOG', ID_MAIN, "oldPICTbrowse.rsrc")
PICTbrowse()
class PICTbrowse(FrameWork.Application):
diff --git a/Mac/Demo/example1/dnslookup-1.py b/Mac/Demo/example1/dnslookup-1.py
index 9a2ab28..2aa7c88 100644
--- a/Mac/Demo/example1/dnslookup-1.py
+++ b/Mac/Demo/example1/dnslookup-1.py
@@ -7,6 +7,7 @@ from Carbon import Dlg
import sys
import socket
import string
+import macresource
#
# Definitions for our resources
ID_MAIN=512
@@ -15,15 +16,10 @@ ITEM_LOOKUP_ENTRY=1
ITEM_RESULT=2
ITEM_LOOKUP_BUTTON=3
ITEM_QUIT_BUTTON=4
-
-
+
def main():
"""Main routine: open resource file, call dialog handler"""
- try:
- Res.FSpOpenResFile("dnslookup-1.rsrc", 1)
- except Res.Error:
- EasyDialogs.Message("Cannot open dnslookup-1.rsrc")
- sys.exit(1)
+ macresource.need("DLOG", ID_MAIN, "dnslookup-1.rsrc")
do_dialog()
def do_dialog():
diff --git a/Mac/Demo/example2/dnslookup-2.py b/Mac/Demo/example2/dnslookup-2.py
index 20e7fa5..9747c4a 100644
--- a/Mac/Demo/example2/dnslookup-2.py
+++ b/Mac/Demo/example2/dnslookup-2.py
@@ -5,6 +5,7 @@ from Carbon import Dlg
import sys
import socket
import string
+import macresource
#
# Definitions for our resources
ID_MAIN=512
@@ -15,14 +16,7 @@ ITEM_RESULT=2
ITEM_LOOKUP_BUTTON=3
def main():
- try:
- dummy = Res.GetResource('DLOG', ID_MAIN)
- except Res.Error:
- try:
- Res.FSpOpenResFile("dnslookup-2.rsrc", 1)
- except Res.Error:
- EasyDialogs.Message("Cannot open dnslookup-2.rsrc")
- sys.exit(1)
+ macresource.need("DLOG", ID_MAIN, "dnslookup-2.rsrc")
DNSLookup()
class DNSLookup(FrameWork.Application):