1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-03-10 05:34:36 +00:00

Converted PyStatsLabel to a core instance mode.

--HG--
branch : objp
This commit is contained in:
Virgil Dupras 2012-01-09 11:15:20 -05:00
parent f636333938
commit 989026051c
7 changed files with 18 additions and 15 deletions

View File

@ -8,11 +8,13 @@ http://www.hardcoded.net/licenses/bsd_license
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import "PyResultTable.h" #import "PyResultTable.h"
#import "PyStatsLabel.h"
#import "PyApp.h" #import "PyApp.h"
@interface PyDupeGuruBase : PyApp @interface PyDupeGuruBase : PyApp
- (void)bindCocoa:(id)cocoa; - (void)bindCocoa:(id)cocoa;
- (PyResultTable *)resultTable; - (PyResultTable *)resultTable;
- (PyStatsLabel *)statsLabel;
//Actions //Actions
- (NSNumber *)addDirectory:(NSString *)name; - (NSNumber *)addDirectory:(NSString *)name;
- (void)loadResultsFrom:(NSString *)filename; - (void)loadResultsFrom:(NSString *)filename;

View File

@ -25,7 +25,7 @@ http://www.hardcoded.net/licenses/bsd_license
/* Put a cute iTunes-like bottom bar */ /* Put a cute iTunes-like bottom bar */
[[self window] setContentBorderThickness:28 forEdge:NSMinYEdge]; [[self window] setContentBorderThickness:28 forEdge:NSMinYEdge];
table = [[ResultTable alloc] initWithPy:[py resultTable] view:matches]; table = [[ResultTable alloc] initWithPy:[py resultTable] view:matches];
statsLabel = [[StatsLabel alloc] initWithPyParent:py labelView:stats]; statsLabel = [[StatsLabel alloc] initWithPy:[py statsLabel] labelView:stats];
problemDialog = [[ProblemDialog alloc] initWithPy:py]; problemDialog = [[ProblemDialog alloc] initWithPy:py];
[self initResultColumns]; [self initResultColumns];
[self fillColumnsMenu]; [self fillColumnsMenu];

View File

@ -10,10 +10,8 @@ http://www.hardcoded.net/licenses/bsd_license
#import "HSGUIController.h" #import "HSGUIController.h"
#import "PyStatsLabel.h" #import "PyStatsLabel.h"
@interface StatsLabel : HSGUIController @interface StatsLabel : HSGUIController {}
{ - (id)initWithPy:(id)aPy labelView:(NSTextField *)aLabelView;
NSTextField *labelView;
}
- (id)initWithPyParent:(id)aPyParent labelView:(NSTextField *)aLabelView;
- (PyStatsLabel *)py; - (PyStatsLabel *)py;
- (NSTextField *)labelView;
@end @end

View File

@ -10,10 +10,9 @@ http://www.hardcoded.net/licenses/bsd_license
#import "Utils.h" #import "Utils.h"
@implementation StatsLabel @implementation StatsLabel
- (id)initWithPyParent:(id)aPyParent labelView:(NSTextField *)aLabelView - (id)initWithPy:(id)aPy labelView:(NSTextField *)aLabelView
{ {
self = [super initWithPyClassName:@"PyStatsLabel" pyParent:aPyParent]; self = [super initWithPy:aPy view:aLabelView];
labelView = [aLabelView retain];
[self connect]; [self connect];
return self; return self;
} }
@ -21,7 +20,6 @@ http://www.hardcoded.net/licenses/bsd_license
- (void)dealloc - (void)dealloc
{ {
[self disconnect]; [self disconnect];
[labelView release];
[super dealloc]; [super dealloc];
} }
@ -30,9 +28,14 @@ http://www.hardcoded.net/licenses/bsd_license
return (PyStatsLabel *)py; return (PyStatsLabel *)py;
} }
- (NSTextField *)labelView
{
return (NSTextField *)[self view];
}
/* Python --> Cocoa */ /* Python --> Cocoa */
- (void)refresh - (void)refresh
{ {
[labelView setStringValue:[[self py] display]]; [[self labelView] setStringValue:[[self py] display]];
} }
@end @end

View File

@ -8,6 +8,7 @@ from hscommon.trans import trget
from core.app import JobType from core.app import JobType
from .result_table import PyResultTable from .result_table import PyResultTable
from .stats_label import PyStatsLabel
tr = trget('ui') tr = trget('ui')
@ -31,6 +32,7 @@ class PyDupeGuruBase(PyFairware):
self.cocoa = cocoa self.cocoa = cocoa
resultTable = subproxy('resultTable', 'result_table', PyResultTable) resultTable = subproxy('resultTable', 'result_table', PyResultTable)
statsLabel = subproxy('statsLabel', 'stats_label', PyStatsLabel)
#---Directories #---Directories
def addDirectory_(self, directory): def addDirectory_(self, directory):

View File

@ -1,9 +1,5 @@
from cocoa.inter import PyGUIObject from cocoa.inter import PyGUIObject
from core.gui.stats_label import StatsLabel
class PyStatsLabel(PyGUIObject): class PyStatsLabel(PyGUIObject):
py_class = StatsLabel
def display(self): def display(self):
return self.py.display return self.py.display

View File

@ -24,6 +24,7 @@ from hscommon.util import (delete_if_empty, first, escape, nonone, format_time_d
from hscommon.trans import tr from hscommon.trans import tr
from . import directories, results, scanner, export, fs from . import directories, results, scanner, export, fs
from .gui.stats_label import StatsLabel
HAD_FIRST_LAUNCH_PREFERENCE = 'HadFirstLaunch' HAD_FIRST_LAUNCH_PREFERENCE = 'HadFirstLaunch'
DEBUG_MODE_PREFERENCE = 'DebugMode' DEBUG_MODE_PREFERENCE = 'DebugMode'
@ -100,6 +101,7 @@ class DupeGuru(RegistrableApplication, Broadcaster):
'ignore_hardlink_matches': False, 'ignore_hardlink_matches': False,
} }
self.selected_dupes = [] self.selected_dupes = []
self.stats_label = StatsLabel(None, self)
# subclasses must create self.result_table # subclasses must create self.result_table
#--- Virtual #--- Virtual