Primitive versions of board, programmer, and port popups

This commit is contained in:
Matthias Neeracher 2014-12-02 13:57:18 +01:00 committed by Matthias Neeracher
parent 30a93365e5
commit c89a9dcb1a
7 changed files with 122 additions and 9 deletions

View File

@ -14,6 +14,7 @@
9501D80C1A17025C0034C530 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9501D80A1A17025C0034C530 /* MainMenu.xib */; }; 9501D80C1A17025C0034C530 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9501D80A1A17025C0034C530 /* MainMenu.xib */; };
9501D8181A17025C0034C530 /* AVRsackTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9501D8171A17025C0034C530 /* AVRsackTests.swift */; }; 9501D8181A17025C0034C530 /* AVRsackTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9501D8171A17025C0034C530 /* AVRsackTests.swift */; };
950AB9271A296A160033A9DA /* ProjIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 950AB9261A296A160033A9DA /* ProjIcon.icns */; }; 950AB9271A296A160033A9DA /* ProjIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 950AB9261A296A160033A9DA /* ProjIcon.icns */; };
950AB9291A2D4F9B0033A9DA /* ASSerial.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950AB9281A2D4F9B0033A9DA /* ASSerial.swift */; };
951CD1741A23C9FC0066C1A1 /* ASBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 951CD1731A23C9FC0066C1A1 /* ASBuilder.swift */; }; 951CD1741A23C9FC0066C1A1 /* ASBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 951CD1731A23C9FC0066C1A1 /* ASBuilder.swift */; };
951CD1771A2615000066C1A1 /* BuildProject in Resources */ = {isa = PBXBuildFile; fileRef = 951CD1761A2615000066C1A1 /* BuildProject */; }; 951CD1771A2615000066C1A1 /* BuildProject in Resources */ = {isa = PBXBuildFile; fileRef = 951CD1761A2615000066C1A1 /* BuildProject */; };
95468DDF1A228BE600668EE2 /* ASHardware.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95468DDE1A228BE600668EE2 /* ASHardware.swift */; }; 95468DDF1A228BE600668EE2 /* ASHardware.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95468DDE1A228BE600668EE2 /* ASHardware.swift */; };
@ -73,6 +74,7 @@
9501D8161A17025C0034C530 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 9501D8161A17025C0034C530 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9501D8171A17025C0034C530 /* AVRsackTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AVRsackTests.swift; sourceTree = "<group>"; }; 9501D8171A17025C0034C530 /* AVRsackTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AVRsackTests.swift; sourceTree = "<group>"; };
950AB9261A296A160033A9DA /* ProjIcon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = ProjIcon.icns; path = IconResources/ProjIcon.icns; sourceTree = "<group>"; }; 950AB9261A296A160033A9DA /* ProjIcon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = ProjIcon.icns; path = IconResources/ProjIcon.icns; sourceTree = "<group>"; };
950AB9281A2D4F9B0033A9DA /* ASSerial.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ASSerial.swift; sourceTree = "<group>"; };
951CD1731A23C9FC0066C1A1 /* ASBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ASBuilder.swift; sourceTree = "<group>"; }; 951CD1731A23C9FC0066C1A1 /* ASBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ASBuilder.swift; sourceTree = "<group>"; };
951CD1761A2615000066C1A1 /* BuildProject */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; fileEncoding = 4; path = BuildProject; sourceTree = "<group>"; }; 951CD1761A2615000066C1A1 /* BuildProject */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; fileEncoding = 4; path = BuildProject; sourceTree = "<group>"; };
95468DDE1A228BE600668EE2 /* ASHardware.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ASHardware.swift; sourceTree = "<group>"; }; 95468DDE1A228BE600668EE2 /* ASHardware.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ASHardware.swift; sourceTree = "<group>"; };
@ -167,6 +169,7 @@
9501D8031A17025C0034C530 /* ASProjDoc.swift */, 9501D8031A17025C0034C530 /* ASProjDoc.swift */,
95BF80EA1A185C9E0004A693 /* ASFileTree.swift */, 95BF80EA1A185C9E0004A693 /* ASFileTree.swift */,
95468DDE1A228BE600668EE2 /* ASHardware.swift */, 95468DDE1A228BE600668EE2 /* ASHardware.swift */,
950AB9281A2D4F9B0033A9DA /* ASSerial.swift */,
951CD1731A23C9FC0066C1A1 /* ASBuilder.swift */, 951CD1731A23C9FC0066C1A1 /* ASBuilder.swift */,
951CD1761A2615000066C1A1 /* BuildProject */, 951CD1761A2615000066C1A1 /* BuildProject */,
); );
@ -341,6 +344,7 @@
9501D8041A17025C0034C530 /* ASProjDoc.swift in Sources */, 9501D8041A17025C0034C530 /* ASProjDoc.swift in Sources */,
95468DDF1A228BE600668EE2 /* ASHardware.swift in Sources */, 95468DDF1A228BE600668EE2 /* ASHardware.swift in Sources */,
951CD1741A23C9FC0066C1A1 /* ASBuilder.swift in Sources */, 951CD1741A23C9FC0066C1A1 /* ASBuilder.swift in Sources */,
950AB9291A2D4F9B0033A9DA /* ASSerial.swift in Sources */,
9501D8021A17025C0034C530 /* ASApplication.swift in Sources */, 9501D8021A17025C0034C530 /* ASApplication.swift in Sources */,
95BF80EB1A185C9E0004A693 /* ASFileTree.swift in Sources */, 95BF80EB1A185C9E0004A693 /* ASFileTree.swift in Sources */,
); );

View File

@ -292,5 +292,18 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate {
builder.cleanProject() builder.cleanProject()
selectNode(files.buildLog) selectNode(files.buildLog)
} }
func serialPorts() -> [String] {
return ASSerial.ports()
}
func boards() -> [String] {
return [String](ASHardware.instance().boards.keys)
}
func programmers() -> [String] {
return [String](ASHardware.instance().programmers.keys)
}
} }

22
AVRsack/ASSerial.swift Normal file
View File

@ -0,0 +1,22 @@
//
// ASSerial.swift
// AVRsack
//
// Created by Matthias Neeracher on 12/2/14.
// Copyright © 2014 Aere Perennius. All rights reserved.
//
import Foundation
class ASSerial {
class func ports() -> [String] {
let devices = NSFileManager.defaultManager().contentsOfDirectoryAtPath("/dev", error: nil)!
var cuDevs = [String]()
for dev in devices as [String] {
if dev.substringToIndex(dev.startIndex.successor().successor()) == "cu" {
cuDevs.append("/dev/"+dev)
}
}
return cuDevs
}
}

View File

@ -95,23 +95,92 @@
</view> </view>
<toolbar key="toolbar" implicitIdentifier="625EA1E8-488D-4F0C-8EE0-5F627F033421" autosavesConfiguration="NO" displayMode="iconAndLabel" sizeMode="regular" id="FLS-YK-Gpe"> <toolbar key="toolbar" implicitIdentifier="625EA1E8-488D-4F0C-8EE0-5F627F033421" autosavesConfiguration="NO" displayMode="iconAndLabel" sizeMode="regular" id="FLS-YK-Gpe">
<allowedToolbarItems> <allowedToolbarItems>
<toolbarItem implicitItemIdentifier="NSToolbarPrintItem" id="ln2-Ky-MBg"/> <toolbarItem implicitItemIdentifier="9276EE94-B438-4F93-AC26-93EC83DAA78E" label="Upload" paletteLabel="Upload" tag="-1" image="UploadIcon" id="2cP-cC-Cr8">
<toolbarItem implicitItemIdentifier="NSToolbarFlexibleSpaceItem" id="2D6-o4-n09"/>
<toolbarItem implicitItemIdentifier="2EA4AC26-099B-4756-8779-ABB6208840D1" label="Build" paletteLabel="Build" tag="-1" image="BuildIcon" id="69r-aN-6vG">
<connections>
<action selector="buildProject:" target="-1" id="Rkc-yl-Vwi"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="EF9FF3B4-6921-497E-B17C-8B0B3D58DA24" label="Upload" paletteLabel="Upload" tag="-1" image="UploadIcon" id="2cP-cC-Cr8">
<connections> <connections>
<action selector="uploadProject:" target="-1" id="p1l-Vg-i2P"/> <action selector="uploadProject:" target="-1" id="p1l-Vg-i2P"/>
</connections> </connections>
</toolbarItem> </toolbarItem>
<toolbarItem implicitItemIdentifier="2E9BF3BA-BCC5-4DB8-B563-8648FC3862AD" label="Clean" paletteLabel="Clean" tag="-1" image="CleanIcon" id="lGv-lT-Eh9"> <toolbarItem implicitItemIdentifier="69F004B0-A5C2-4130-9306-CBDA9B75A34E" label="Build" paletteLabel="Build" tag="-1" image="BuildIcon" id="69r-aN-6vG">
<connections>
<action selector="buildProject:" target="-1" id="Rkc-yl-Vwi"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="2B98B0B2-C192-4A20-9C17-8CDBD6A9002F" label="Clean" paletteLabel="Clean" tag="-1" image="CleanIcon" id="lGv-lT-Eh9">
<connections> <connections>
<action selector="cleanProject:" target="-1" id="LzL-6C-IDi"/> <action selector="cleanProject:" target="-1" id="LzL-6C-IDi"/>
</connections> </connections>
</toolbarItem> </toolbarItem>
<toolbarItem implicitItemIdentifier="A3F4B25E-669B-4AEB-877C-CA0AF13A9E49" label="Board" paletteLabel="Board" id="vAE-60-8kd">
<nil key="toolTip"/>
<size key="minSize" width="100" height="28"/>
<size key="maxSize" width="100" height="28"/>
<popUpButton key="view" verticalHuggingPriority="750" id="xO5-xB-HHj">
<rect key="frame" x="0.0" y="0.0" width="100" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="roundTextured" title="Item 1" bezelStyle="texturedRounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" selectedItem="EIo-LP-BL2" id="70v-IV-ury">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="0W3-Jd-NvF">
<items>
<menuItem title="Item 1" state="on" id="EIo-LP-BL2"/>
<menuItem title="Item 2" id="BI3-Mj-Hjl"/>
<menuItem title="Item 3" id="JVV-uK-XFS"/>
</items>
</menu>
</popUpButtonCell>
<connections>
<binding destination="-2" name="contentValues" keyPath="boards" id="I0F-IB-VDu"/>
</connections>
</popUpButton>
</toolbarItem>
<toolbarItem implicitItemIdentifier="BD8B4827-8CD2-4E50-B435-165CD744B39D" label="Programmer" paletteLabel="Programmer" id="Lt2-Z7-7Pg">
<nil key="toolTip"/>
<size key="minSize" width="100" height="28"/>
<size key="maxSize" width="100" height="28"/>
<popUpButton key="view" verticalHuggingPriority="750" id="08n-xg-fNl">
<rect key="frame" x="0.0" y="0.0" width="100" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="roundTextured" title="Item 1" bezelStyle="texturedRounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" selectedItem="DL9-Dk-EGd" id="drB-K8-prb">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="I2g-9Y-t88">
<items>
<menuItem title="Item 1" state="on" id="DL9-Dk-EGd"/>
<menuItem title="Item 2" id="cbL-7g-Dbs"/>
<menuItem title="Item 3" id="VZO-b8-lTE"/>
</items>
</menu>
</popUpButtonCell>
<connections>
<binding destination="-2" name="contentValues" keyPath="programmers" id="6XS-xq-UIC"/>
</connections>
</popUpButton>
</toolbarItem>
<toolbarItem implicitItemIdentifier="1E69CE88-D7A1-4231-B56C-89C813E75589" label="Serial Port" paletteLabel="Serial Port" id="r8E-ar-tLo">
<nil key="toolTip"/>
<size key="minSize" width="100" height="28"/>
<size key="maxSize" width="100" height="28"/>
<popUpButton key="view" verticalHuggingPriority="750" id="4rZ-U5-AH6">
<rect key="frame" x="0.0" y="0.0" width="100" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="roundTextured" title="Item 1" bezelStyle="texturedRounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" selectedItem="7U0-rg-90a" id="XSm-NS-ZtW">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="VO0-bS-zYz">
<items>
<menuItem title="Item 1" state="on" id="7U0-rg-90a"/>
<menuItem title="Item 2" id="rck-gJ-Wwo"/>
<menuItem title="Item 3" id="PoP-ir-bnB"/>
</items>
</menu>
</popUpButtonCell>
<connections>
<binding destination="-2" name="contentValues" keyPath="serialPorts" id="d9a-Yy-DeA"/>
</connections>
</popUpButton>
</toolbarItem>
<toolbarItem implicitItemIdentifier="NSToolbarPrintItem" id="ln2-Ky-MBg"/>
<toolbarItem implicitItemIdentifier="NSToolbarFlexibleSpaceItem" id="2D6-o4-n09"/>
<toolbarItem implicitItemIdentifier="NSToolbarSpaceItem" id="FYt-ZW-Epr"/> <toolbarItem implicitItemIdentifier="NSToolbarSpaceItem" id="FYt-ZW-Epr"/>
</allowedToolbarItems> </allowedToolbarItems>
<defaultToolbarItems> <defaultToolbarItems>
@ -120,6 +189,10 @@
<toolbarItem reference="FYt-ZW-Epr"/> <toolbarItem reference="FYt-ZW-Epr"/>
<toolbarItem reference="lGv-lT-Eh9"/> <toolbarItem reference="lGv-lT-Eh9"/>
<toolbarItem reference="2D6-o4-n09"/> <toolbarItem reference="2D6-o4-n09"/>
<toolbarItem reference="vAE-60-8kd"/>
<toolbarItem reference="Lt2-Z7-7Pg"/>
<toolbarItem reference="r8E-ar-tLo"/>
<toolbarItem reference="2D6-o4-n09"/>
<toolbarItem reference="ln2-Ky-MBg"/> <toolbarItem reference="ln2-Ky-MBg"/>
</defaultToolbarItems> </defaultToolbarItems>
</toolbar> </toolbar>
@ -128,6 +201,7 @@
</connections> </connections>
<point key="canvasLocation" x="406" y="428.5"/> <point key="canvasLocation" x="406" y="428.5"/>
</window> </window>
<userDefaultsController representsSharedInstance="YES" id="fpc-q0-yYy"/>
</objects> </objects>
<resources> <resources>
<image name="BuildIcon" width="32" height="32"/> <image name="BuildIcon" width="32" height="32"/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 14 KiB