| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 95ca9fb commit 88a7a84
18 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,9 @@ | |||
| 1 | 1 | # encoding: utf-8 | |
| 2 | 2 | import os, re, types | |
| 3 | - from AppKit import * | ||
| 4 | 3 | from contextlib import contextmanager, nested | |
| 5 | 4 | from collections import namedtuple | |
| 6 | 5 | ||
| 6 | + from .lib.cocoa import * | ||
| 7 | 7 | from .util import _copy_attr, _copy_attrs, _flatten, trim_zeroes | |
| 8 | 8 | from .lib import geometry, pathmatics | |
| 9 | 9 | from .gfx.transform import Dimension | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,6 @@ | |||
| 1 | 1 | # encoding: utf-8 | |
| 2 | 2 | from contextlib import contextmanager | |
| 3 | - from AppKit import * | ||
| 4 | - from Foundation import * | ||
| 5 | - from Quartz import * | ||
| 3 | + from ..lib.cocoa import * | ||
| 6 | 4 | ||
| 7 | 5 | ### graphics context mgmt ### | |
| 8 | 6 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,6 @@ | |||
| 1 | 1 | # encoding: utf-8 | |
| 2 | 2 | import warnings | |
| 3 | - from AppKit import * | ||
| 4 | - from Foundation import * | ||
| 5 | - from Quartz import * | ||
| 3 | + from ..lib.cocoa import * | ||
| 6 | 4 | from math import pi, sin, cos, sqrt | |
| 7 | 5 | ||
| 8 | 6 | from plotdevice import DeviceError | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,9 +3,7 @@ | |||
| 3 | 3 | import re | |
| 4 | 4 | import json | |
| 5 | 5 | import warnings | |
| 6 | - from AppKit import * | ||
| 7 | - from Foundation import * | ||
| 8 | - from Quartz import * | ||
| 6 | + from ..lib.cocoa import * | ||
| 9 | 7 | ||
| 10 | 8 | from plotdevice import DeviceError | |
| 11 | 9 | from ..util import _copy_attr, _copy_attrs, _flatten, trim_zeroes, rsrc_path | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,9 +2,7 @@ | |||
| 2 | 2 | import os | |
| 3 | 3 | import re | |
| 4 | 4 | from contextlib import contextmanager | |
| 5 | - from AppKit import * | ||
| 6 | - from Foundation import * | ||
| 7 | - from Quartz import * | ||
| 5 | + from ..lib.cocoa import * | ||
| 8 | 6 | ||
| 9 | 7 | from plotdevice import DeviceError | |
| 10 | 8 | from ..util import _copy_attr, _copy_attrs | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,10 +5,7 @@ | |||
| 5 | 5 | import warnings | |
| 6 | 6 | import math | |
| 7 | 7 | from contextlib import contextmanager | |
| 8 | - from AppKit import * | ||
| 9 | - from Foundation import * | ||
| 10 | - from Quartz import * | ||
| 11 | - from Quartz.PDFKit import * | ||
| 8 | + from ..lib.cocoa import * | ||
| 12 | 9 | ||
| 13 | 10 | from plotdevice import DeviceError | |
| 14 | 11 | from ..util import _copy_attrs | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,9 +4,7 @@ | |||
| 4 | 4 | import json | |
| 5 | 5 | import warnings | |
| 6 | 6 | import math | |
| 7 | - from AppKit import * | ||
| 8 | - from Foundation import * | ||
| 9 | - from Quartz import * | ||
| 7 | + from ..lib.cocoa import * | ||
| 10 | 8 | ||
| 11 | 9 | from plotdevice import DeviceError | |
| 12 | 10 | from ..util import trim_zeroes | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,8 +3,7 @@ | |||
| 3 | 3 | from xml.parsers import expat | |
| 4 | 4 | from operator import itemgetter, attrgetter | |
| 5 | 5 | from plotdevice.util import odict, ddict | |
| 6 | - from AppKit import * | ||
| 7 | - from Foundation import * | ||
| 6 | + from ..lib.cocoa import * | ||
| 8 | 7 | ||
| 9 | 8 | from plotdevice import DeviceError, INTERNAL as DEFAULT | |
| 10 | 9 | from .atoms import TransformMixin, ColorMixin, EffectsMixin, StyleMixin, BoundsMixin, Grob | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,8 +3,7 @@ | |||
| 3 | 3 | import os | |
| 4 | 4 | import objc | |
| 5 | 5 | from glob import glob | |
| 6 | - from Foundation import * | ||
| 7 | - from AppKit import * | ||
| 6 | + from ..lib.cocoa import * | ||
| 8 | 7 | from PyObjCTools import AppHelper | |
| 9 | 8 | from .preferences import PlotDevicePreferencesController, get_default | |
| 10 | 9 | from . import bundle_path, set_timeout | |
@@ -13,8 +12,8 @@ | |||
| 13 | 12 | """ | |
| 14 | 13 | ||
| 15 | 14 | class PlotDeviceAppDelegate(NSObject): | |
| 16 | - examplesMenu = objc.IBOutlet() | ||
| 17 | - updatesMenu = objc.IBOutlet() | ||
| 15 | + examplesMenu = IBOutlet() | ||
| 16 | + updatesMenu = IBOutlet() | ||
| 18 | 17 | ||
| 19 | 18 | def awakeFromNib(self): | |
| 20 | 19 | self._prefsController = None | |
@@ -77,14 +76,14 @@ def updateExamples(self): | |||
| 77 | 76 | folders[cat].addItem_(item) | |
| 78 | 77 | self.examplesMenu.setHidden_(not pyfiles) | |
| 79 | 78 | ||
| 80 | - @objc.IBAction | ||
| 79 | + @IBAction | ||
| 81 | 80 | def newSketch_(self, sender): | |
| 82 | 81 | kind = ['sketch','anim','ottobot'][sender.tag()] | |
| 83 | 82 | doc = self.docFromTemplate_('TMPL:'+kind) | |
| 84 | 83 | if kind=='ottobot': | |
| 85 | 84 | AppHelper.callLater(0.1, doc.script.runScript) | |
| 86 | 85 | ||
| 87 | - @objc.IBAction | ||
| 86 | + @IBAction | ||
| 88 | 87 | def openExample_(self, sender): | |
| 89 | 88 | tmpl = sender.representedObject() | |
| 90 | 89 | self.docFromTemplate_(tmpl) | |
@@ -98,18 +97,18 @@ def docFromTemplate_(self, tmpl): | |||
| 98 | 97 | doc.showWindows() | |
| 99 | 98 | return doc | |
| 100 | 99 | ||
| 101 | - @objc.IBAction | ||
| 100 | + @IBAction | ||
| 102 | 101 | def showPreferencesPanel_(self, sender): | |
| 103 | 102 | if self._prefsController is None: | |
| 104 | 103 | self._prefsController = PlotDevicePreferencesController.alloc().init() | |
| 105 | 104 | self._prefsController.showWindow_(sender) | |
| 106 | 105 | ||
| 107 | - @objc.IBAction | ||
| 106 | + @IBAction | ||
| 108 | 107 | def showHelp_(self, sender): | |
| 109 | 108 | url = NSURL.URLWithString_("http://plotdevice.io/doc") | |
| 110 | 109 | NSWorkspace.sharedWorkspace().openURL_(url) | |
| 111 | 110 | ||
| 112 | - @objc.IBAction | ||
| 111 | + @IBAction | ||
| 113 | 112 | def showSite_(self, sender): | |
| 114 | 113 | url = NSURL.URLWithString_("http://plotdevice.io/") | |
| 115 | 114 | NSWorkspace.sharedWorkspace().openURL_(url) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,8 +7,7 @@ | |||
| 7 | 7 | import time | |
| 8 | 8 | import objc | |
| 9 | 9 | ||
| 10 | - from Foundation import * | ||
| 11 | - from AppKit import * | ||
| 10 | + from ..lib.cocoa import * | ||
| 12 | 11 | ||
| 13 | 12 | from .editor import OutputTextView, EditorView | |
| 14 | 13 | from .widgets import DashboardController, ExportSheet | |
@@ -114,14 +113,14 @@ def _refresh(self): | |||
| 114 | 113 | # `file's owner' in PlotDeviceDocument.xib | |
| 115 | 114 | class ScriptController(NSWindowController): | |
| 116 | 115 | # main document window | |
| 117 | - graphicsView = objc.IBOutlet() | ||
| 118 | - outputView = objc.IBOutlet() | ||
| 119 | - editorView = objc.IBOutlet() | ||
| 120 | - statusView = objc.IBOutlet() | ||
| 116 | + graphicsView = IBOutlet() | ||
| 117 | + outputView = IBOutlet() | ||
| 118 | + editorView = IBOutlet() | ||
| 119 | + statusView = IBOutlet() | ||
| 121 | 120 | ||
| 122 | 121 | # auxiliary windows | |
| 123 | - dashboardController = objc.IBOutlet() | ||
| 124 | - exportSheet = objc.IBOutlet() | ||
| 122 | + dashboardController = IBOutlet() | ||
| 123 | + exportSheet = IBOutlet() | ||
| 125 | 124 | ||
| 126 | 125 | ## Properties | |
| 127 | 126 | ||
@@ -301,14 +300,14 @@ def shouldCloseDocument(self): | |||
| 301 | 300 | # Running the script in the main window | |
| 302 | 301 | # | |
| 303 | 302 | ||
| 304 | - @objc.IBAction | ||
| 303 | + @IBAction | ||
| 305 | 304 | def runScript_(self, sender): | |
| 306 | 305 | # listens for cmd-r | |
| 307 | 306 | if self.vm.session: | |
| 308 | 307 | return NSBeep() | |
| 309 | 308 | self.runScript() | |
| 310 | 309 | ||
| 311 | - @objc.IBAction | ||
| 310 | + @IBAction | ||
| 312 | 311 | def runFullscreen_(self, sender): | |
| 313 | 312 | # listens for cmd-shift-r | |
| 314 | 313 | if not self.fullScreen: | |
@@ -456,13 +455,13 @@ def _ui_state(self): | |||
| 456 | 455 | # | |
| 457 | 456 | # Exporting to file(s) | |
| 458 | 457 | # | |
| 459 | - @objc.IBAction | ||
| 458 | + @IBAction | ||
| 460 | 459 | def exportAsImage_(self, sender): | |
| 461 | 460 | if self.vm.session: | |
| 462 | 461 | return NSBeep() | |
| 463 | 462 | self.exportSheet.beginExport('image') | |
| 464 | 463 | ||
| 465 | - @objc.IBAction | ||
| 464 | + @IBAction | ||
| 466 | 465 | def exportAsMovie_(self, sender): | |
| 467 | 466 | if self.vm.session: | |
| 468 | 467 | return NSBeep() | |
@@ -514,7 +513,7 @@ def exportStatus(self, event): | |||
| 514 | 513 | # | |
| 515 | 514 | # Interrupting the run | |
| 516 | 515 | # | |
| 517 | - @objc.IBAction | ||
| 516 | + @IBAction | ||
| 518 | 517 | def stopScript_(self, sender=None): | |
| 519 | 518 | # catch command-period | |
| 520 | 519 | if self.vm.session: | |
@@ -583,14 +582,14 @@ def crash(self): | |||
| 583 | 582 | # | |
| 584 | 583 | # Pasteboards | |
| 585 | 584 | # | |
| 586 | - @objc.IBAction | ||
| 585 | + @IBAction | ||
| 587 | 586 | def copyImageAsPDF_(self, sender): | |
| 588 | 587 | pboard = NSPasteboard.generalPasteboard() | |
| 589 | 588 | # graphicsView implements the pboard delegate method to provide the data | |
| 590 | 589 | pboard.declareTypes_owner_([NSPDFPboardType,NSPostScriptPboardType,NSTIFFPboardType], self.graphicsView) | |
| 591 | 590 | ||
| 592 | 591 | ||
| 593 | - @objc.IBAction | ||
| 592 | + @IBAction | ||
| 594 | 593 | def printDocument_(self, sender): | |
| 595 | 594 | op = NSPrintOperation.printOperationWithView_printInfo_(self.graphicsView, self.printInfo()) | |
| 596 | 595 | op.runOperationModalForWindow_delegate_didRunSelector_contextInfo_( | |
@@ -607,22 +606,22 @@ def printOperationDidRun_success_contextInfo_(self, op, success, info): | |||
| 607 | 606 | # | |
| 608 | 607 | # Zoom commands, forwarding to the graphics view. | |
| 609 | 608 | # | |
| 610 | - @objc.IBAction | ||
| 609 | + @IBAction | ||
| 611 | 610 | def zoomIn_(self, sender): | |
| 612 | 611 | if self.fullScreen is not None: return | |
| 613 | 612 | self.graphicsView.zoomIn_(sender) | |
| 614 | 613 | ||
| 615 | - @objc.IBAction | ||
| 614 | + @IBAction | ||
| 616 | 615 | def zoomOut_(self, sender): | |
| 617 | 616 | if self.fullScreen is not None: return | |
| 618 | 617 | self.graphicsView.zoomOut_(sender) | |
| 619 | 618 | ||
| 620 | - @objc.IBAction | ||
| 619 | + @IBAction | ||
| 621 | 620 | def zoomToTag_(self, sender): | |
| 622 | 621 | if self.fullScreen is not None: return | |
| 623 | 622 | self.graphicsView.zoomTo_(sender.tag() / 100.0) | |
| 624 | 623 | ||
| 625 | - @objc.IBAction | ||
| 624 | + @IBAction | ||
| 626 | 625 | def zoomToFit_(self, sender): | |
| 627 | 626 | if self.fullScreen is not None: return | |
| 628 | 627 | self.graphicsView.zoomToFit_(sender) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments