Skip to content

Commit

Permalink
All functionality in segment four is complete. Theoretically.
Browse files Browse the repository at this point in the history
  • Loading branch information
lethain committed Aug 26, 2008
1 parent 5fb4dd9 commit 5019a9e
Show file tree
Hide file tree
Showing 15 changed files with 1,015 additions and 57 deletions.
21 changes: 19 additions & 2 deletions MWController.py
Expand Up @@ -7,6 +7,7 @@
#

import objc, metaweb, webbrowser, pickle, datetime, md5, threading
from MWRowWindowController import MWRowWindowController
from AppKit import *
from Foundation import *

Expand All @@ -17,6 +18,7 @@ class MWController(NSObject):
arrayController = objc.IBOutlet()
indicator = objc.IBOutlet()
results = []
rowCache = {}
_cache = None

def getCache(self):
Expand All @@ -29,6 +31,13 @@ def awakeFromNib(self):
if self.tableView:
self.tableView.setTarget_(self)
self.tableView.setDoubleAction_("open:")
self.tableView.setDraggingSourceOperationMask_forLocal_(NSDragOperationCopy, False)

def dealloc(self):
for key in self.rowCache:
value = self.rowCache[key]
value.release()
super(MWController,self).dealloc()

def open_(self,sender):
selectedObjs = self.arrayController.selectedObjects()
Expand All @@ -42,8 +51,16 @@ def open_(self,sender):
NSLog(u"Row has no id!")
return

url = u"http://www.freebase.com/view%s" % row['id']
webbrowser.open(url)
if self.rowCache.has_key(row):
rwc = self.rowCache[row]
rwc.showWindow_(self)
else:
rwc =MWRowWindowController.alloc().initWithWindowNibName_(u"RowWindow")
rwc.rowDict = row
rwc.showWindow_(self)
rwc.retain()
self.rowCache[row] = rwc


def getCachedSearch(self,searchString):
if self.cache.has_key(searchString):
Expand Down
12 changes: 12 additions & 0 deletions MWRowWindowController.py
@@ -0,0 +1,12 @@
#
# MWRowWindowController.py
# MetaWindow
#
# Created by Will Larson on 8/26/08.
# Copyright (c) 2008 Will Larson. All rights reserved.
#

from Foundation import *

class MWRowWindowController(NSWindowController):
rowDict = None
8 changes: 8 additions & 0 deletions MetaWindow.xcodeproj/project.pbxproj
Expand Up @@ -17,6 +17,8 @@
BEA672E20E60965500FC6C91 /* metaweb.py in Resources */ = {isa = PBXBuildFile; fileRef = BEA672E10E60965500FC6C91 /* metaweb.py */; };
BEE74BF80E6437630081791E /* MWDragWindow.py in Resources */ = {isa = PBXBuildFile; fileRef = BEE74BF70E6437630081791E /* MWDragWindow.py */; };
BEE74C160E646F0B0081791E /* MWDragArrayController.py in Resources */ = {isa = PBXBuildFile; fileRef = BEE74C150E646F0B0081791E /* MWDragArrayController.py */; };
BEE74CB40E647FDB0081791E /* MWRowWindowController.py in Resources */ = {isa = PBXBuildFile; fileRef = BEE74CB30E647FDB0081791E /* MWRowWindowController.py */; };
BEE74CCE0E64865C0081791E /* RowWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = BEE74CCD0E64865C0081791E /* RowWindow.xib */; };
BEE9BD050E5F404A00CBCEC3 /* MWController.py in Resources */ = {isa = PBXBuildFile; fileRef = BEE9BD040E5F404A00CBCEC3 /* MWController.py */; };
/* End PBXBuildFile section */

Expand All @@ -37,6 +39,8 @@
BEA672E10E60965500FC6C91 /* metaweb.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = metaweb.py; sourceTree = "<group>"; };
BEE74BF70E6437630081791E /* MWDragWindow.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = MWDragWindow.py; sourceTree = "<group>"; };
BEE74C150E646F0B0081791E /* MWDragArrayController.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = MWDragArrayController.py; sourceTree = "<group>"; };
BEE74CB30E647FDB0081791E /* MWRowWindowController.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = MWRowWindowController.py; sourceTree = "<group>"; };
BEE74CCD0E64865C0081791E /* RowWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = RowWindow.xib; sourceTree = "<group>"; };
BEE9BD040E5F404A00CBCEC3 /* MWController.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = MWController.py; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -94,6 +98,7 @@
29B97314FDCFA39411CA2CEA /* MetaWindow */ = {
isa = PBXGroup;
children = (
BEE74CB30E647FDB0081791E /* MWRowWindowController.py */,
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
Expand All @@ -117,6 +122,7 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
BEE74CCD0E64865C0081791E /* RowWindow.xib */,
77C8C1F70C07829500965286 /* MainMenu.xib */,
8D1107310486CEB800E47090 /* Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
Expand Down Expand Up @@ -184,6 +190,8 @@
BEA672E20E60965500FC6C91 /* metaweb.py in Resources */,
BEE74BF80E6437630081791E /* MWDragWindow.py in Resources */,
BEE74C160E646F0B0081791E /* MWDragArrayController.py in Resources */,
BEE74CB40E647FDB0081791E /* MWRowWindowController.py in Resources */,
BEE74CCE0E64865C0081791E /* RowWindow.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
54 changes: 34 additions & 20 deletions MetaWindow.xcodeproj/will.mode1v3
Expand Up @@ -255,7 +255,7 @@
<dict>
<key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
<array>
<real>186</real>
<real>217</real>
</array>
<key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
<array>
Expand All @@ -276,13 +276,13 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
<integer>13</integer>
<integer>12</integer>
<integer>11</integer>
<integer>0</integer>
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
<string>{{0, 0}, {186, 604}}</string>
<string>{{0, 0}, {217, 604}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
Expand All @@ -294,19 +294,19 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {203, 622}}</string>
<string>{{0, 0}, {234, 622}}</string>
<key>GroupTreeTableConfiguration</key>
<array>
<string>MainColumn</string>
<real>186</real>
<real>217</real>
</array>
<key>RubberWindowFrame</key>
<string>81 115 812 663 0 0 1280 778 </string>
<string>41 115 812 663 0 0 1280 778 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
<key>Proportion</key>
<string>203pt</string>
<string>234pt</string>
</dict>
<dict>
<key>Dock</key>
Expand All @@ -319,29 +319,30 @@
<key>PBXProjectModuleGUID</key>
<string>1CE0B20306471E060097A5F4</string>
<key>PBXProjectModuleLabel</key>
<string>MWDragArrayController.py</string>
<string>MWController.py</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>1CE0B20406471E060097A5F4</string>
<key>PBXProjectModuleLabel</key>
<string>MWDragArrayController.py</string>
<string>MWController.py</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>BEE74CAD0E6479B40081791E</string>
<string>BEE74D2C0E64C8F30081791E</string>
<key>history</key>
<array>
<string>BEE9BD0E0E5F6FBC00CBCEC3</string>
<string>BEE9BD2A0E5F74D200CBCEC3</string>
<string>BEA672FE0E60B55F00FC6C91</string>
<string>BEBECB4E0E63292600AD943E</string>
<string>BEE74C170E646F110081791E</string>
<string>BEE74C190E646F110081791E</string>
<string>BEE74C310E64703E0081791E</string>
<string>BEE74C320E64703E0081791E</string>
<string>BEE74CD10E64B5800081791E</string>
<string>BEE74CF80E64BA770081791E</string>
<string>BEE74D070E64BBD00081791E</string>
<string>BEE74D100E64BC410081791E</string>
<string>BEE74D060E64BBD00081791E</string>
</array>
<key>prevStack</key>
<array>
Expand All @@ -357,6 +358,19 @@
<string>BEE74C1E0E646F110081791E</string>
<string>BEE74C2F0E646F910081791E</string>
<string>BEE74C330E64703E0081791E</string>
<string>BEE74CAF0E647AA10081791E</string>
<string>BEE74CCA0E6486470081791E</string>
<string>BEE74CCB0E6486470081791E</string>
<string>BEE74CD20E64B5800081791E</string>
<string>BEE74CD30E64B5800081791E</string>
<string>BEE74CD70E64B5F60081791E</string>
<string>BEE74CF10E64BA310081791E</string>
<string>BEE74CF90E64BA770081791E</string>
<string>BEE74CFA0E64BA770081791E</string>
<string>BEE74D090E64BBD00081791E</string>
<string>BEE74D0A0E64BBD00081791E</string>
<string>BEE74D0B0E64BBD00081791E</string>
<string>BEE74D110E64BC410081791E</string>
</array>
</dict>
<key>SplitCount</key>
Expand All @@ -368,9 +382,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {604, 352}}</string>
<string>{{0, 0}, {573, 352}}</string>
<key>RubberWindowFrame</key>
<string>81 115 812 663 0 0 1280 778 </string>
<string>41 115 812 663 0 0 1280 778 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
Expand All @@ -388,9 +402,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 357}, {604, 265}}</string>
<string>{{0, 357}, {573, 265}}</string>
<key>RubberWindowFrame</key>
<string>81 115 812 663 0 0 1280 778 </string>
<string>41 115 812 663 0 0 1280 778 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
Expand All @@ -399,7 +413,7 @@
</dict>
</array>
<key>Proportion</key>
<string>604pt</string>
<string>573pt</string>
</dict>
</array>
<key>Name</key>
Expand Down Expand Up @@ -558,7 +572,7 @@
<string>/Users/will/git/MetaWindow/MetaWindow.xcodeproj</string>
</array>
<key>WindowString</key>
<string>81 115 812 663 0 0 1280 778 </string>
<string>41 115 812 663 0 0 1280 778 </string>
<key>WindowToolsV3</key>
<array>
<dict>
Expand Down

0 comments on commit 5019a9e

Please sign in to comment.