[23077] users/rhwood/Pallet

source_changes at macosforge.org source_changes at macosforge.org
Sat Mar 24 07:01:23 PDT 2007


Revision: 23077
          http://trac.macosforge.org/projects/macports/changeset/23077
Author:   rhwood at macports.org
Date:     2007-03-24 07:01:22 -0700 (Sat, 24 Mar 2007)

Log Message:
-----------
Ports are now installable.
Multiple selections can be installed at once.
Begin work on making status line display the ---> lines from port.

Modified Paths:
--------------
    users/rhwood/Pallet/English.lproj/MainMenu.nib/info.nib
    users/rhwood/Pallet/English.lproj/MainMenu.nib/keyedobjects.nib
    users/rhwood/Pallet/PortAuthority.h
    users/rhwood/Pallet/PortAuthority.m

Modified: users/rhwood/Pallet/English.lproj/MainMenu.nib/info.nib
===================================================================
--- users/rhwood/Pallet/English.lproj/MainMenu.nib/info.nib	2007-03-24 13:30:30 UTC (rev 23076)
+++ users/rhwood/Pallet/English.lproj/MainMenu.nib/info.nib	2007-03-24 14:01:22 UTC (rev 23077)
@@ -23,10 +23,10 @@
 	</array>
 	<key>IBOpenObjects</key>
 	<array>
-		<integer>29</integer>
+		<integer>21</integer>
 		<integer>568</integer>
 		<integer>290</integer>
-		<integer>21</integer>
+		<integer>29</integer>
 	</array>
 	<key>IBSystem Version</key>
 	<string>8P135</string>

Modified: users/rhwood/Pallet/English.lproj/MainMenu.nib/keyedobjects.nib
===================================================================
(Binary files differ)

Modified: users/rhwood/Pallet/PortAuthority.h
===================================================================
--- users/rhwood/Pallet/PortAuthority.h	2007-03-24 13:30:30 UTC (rev 23076)
+++ users/rhwood/Pallet/PortAuthority.h	2007-03-24 14:01:22 UTC (rev 23077)
@@ -72,6 +72,7 @@
 - (IBAction)upgradePort:(id)sender;
 - (IBAction)haltPortCommand:(id)sender;
 
+- (void)installSinglePort:(NSString *)name;
 - (void)runPortCommand:(NSString *)action port:(NSString *)port;
 - (void)runPortCommandInThread:(id)parameters;
 

Modified: users/rhwood/Pallet/PortAuthority.m
===================================================================
--- users/rhwood/Pallet/PortAuthority.m	2007-03-24 13:30:30 UTC (rev 23076)
+++ users/rhwood/Pallet/PortAuthority.m	2007-03-24 14:01:22 UTC (rev 23077)
@@ -31,6 +31,7 @@
 @implementation PortAuthority
 
 enum portCommands {
+	portInstall,
 	portList,
 	portListAll,
 	portSync,
@@ -244,6 +245,9 @@
 #pragma mark PORT COMMANDS
 
 - (void)defaultAction:(id)items
+/*
+ rewrite to use other methods in this class to avoid duplication
+ */
 {
 	id item;
 	switch ([[item valueForKey:@"status"] intValue]) {
@@ -278,8 +282,31 @@
 
 - (IBAction)installPort:(id)sender
 {
+	portCommand = portInstall;
+	NSArray *selection = [portIndexController selectedObjects];
+	NSEnumerator *selectionEnumerator = [selection objectEnumerator];
+	id port;
+	while (port = [selectionEnumerator nextObject]) {
+		[self installSinglePort:[port objectForKey:@"name"]];
+	}
 }
 
+- (void)installSinglePort:(NSString *)port
+{
+	[status setStringValue:[NSString localizedStringWithFormat:NSLocalizedStringWithDefaultValue(@"statusInstallPort",
+															 @"Localizable",
+															 [NSBundle mainBundle],
+															 @"Preparing to install %@",
+															 @"Status for [MPAuthority installPort] method"),
+		port]];
+	NSLog([status stringValue]);
+	[self launchAuthorizedExecutableWithArguments:[NSArray arrayWithObjects:macPortsPort,
+		@"-dv",
+		@"install",
+		port,
+		nil]];
+}
+
 - (IBAction)reinstallPort:(id)sender
 {
 }
@@ -325,6 +352,7 @@
 															 @"Preparing to upgrade all outdated ports...",
 															 @"Status for [MPAuthority upgradeOutdated] method")];
 	[self launchAuthorizedExecutableWithArguments:[NSArray arrayWithObjects:macPortsPort,
+		@"-dv",
 		@"upgrade",
 		@"outdated",
 		nil]];
@@ -518,8 +546,18 @@
 
 - (void)captureOutput:(NSString*)str forExecutable:(AuthorizedExecutable*)exe
 {
+	NSRange marker, eol;
     [[portLog textStorage] appendAttributedString: [[[NSAttributedString alloc]
                              initWithString: str] autorelease]];
+	@try {
+		marker = [str rangeOfString:@"--->"];
+		eol = [str rangeOfString:@"\n" options:NSLiteralSearch range:NSMakeRange(marker.location + 4, [str length] - marker.location)];
+		NSLog([str substringWithRange:NSMakeRange(marker.location + 4, eol.location - (marker.location + 4))]);
+	}		
+	@catch (NSException *exception) {
+		// Exceptions will be thrown where "--->" is not in str
+		// Ignore the exceptions since we want to change the status line only if such a line exists
+	}
     [self performSelector:@selector(scrollToVisible:) withObject:nil afterDelay:0.0];
 }
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070324/65ba47e7/attachment.html


More information about the macports-changes mailing list