mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-09 21:24:36 +00:00
Removed temporary objp conversion hacks.
--HG-- branch : objp
This commit is contained in:
parent
950cd0c341
commit
55db21f3e0
2
build.py
2
build.py
@ -179,7 +179,7 @@ def build_cocoa_bridging_interfaces():
|
||||
import objp.p2o
|
||||
add_to_pythonpath('cocoa')
|
||||
add_to_pythonpath('cocoalib')
|
||||
from cocoa.inter2 import (PyGUIObject, GUIObjectView, PyColumns, ColumnsView, PyOutline,
|
||||
from cocoa.inter import (PyGUIObject, GUIObjectView, PyColumns, ColumnsView, PyOutline,
|
||||
OutlineView, PySelectableList, SelectableListView, PyTable, TableView, PyFairware)
|
||||
from inter.details_panel import PyDetailsPanel, DetailsPanelView
|
||||
from inter.directory_outline import PyDirectoryOutline, DirectoryOutlineView
|
||||
|
@ -62,7 +62,7 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
- (DetailsPanel *)createDetailsPanel
|
||||
{
|
||||
return [[DetailsPanel alloc] init];
|
||||
return [[DetailsPanel alloc] initWithPyRef:[model detailsPanel]];
|
||||
}
|
||||
|
||||
- (NSString *)homepageURL
|
||||
@ -210,7 +210,7 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
/* model --> view */
|
||||
- (void)showExtraFairwareReminder
|
||||
{
|
||||
ExtraFairwareReminder *dialog = [[ExtraFairwareReminder alloc] init];
|
||||
ExtraFairwareReminder *dialog = [[ExtraFairwareReminder alloc] initWithPyRef:[model extraFairwareReminder]];
|
||||
[dialog start];
|
||||
[NSApp runModalForWindow:[dialog window]];
|
||||
[dialog close];
|
||||
|
@ -7,16 +7,17 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <Python.h>
|
||||
#import "PyDetailsPanel.h"
|
||||
|
||||
@interface DetailsPanel : NSWindowController
|
||||
{
|
||||
IBOutlet NSTableView *detailsTable;
|
||||
|
||||
PyDetailsPanel *py;
|
||||
PyDetailsPanel *model;
|
||||
}
|
||||
- (id)init;
|
||||
- (PyDetailsPanel *)py;
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef;
|
||||
- (PyDetailsPanel *)model;
|
||||
|
||||
- (BOOL)isVisible;
|
||||
- (void)toggleVisibility;
|
||||
|
@ -10,26 +10,26 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation DetailsPanel
|
||||
- (id)init
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef
|
||||
{
|
||||
self = [super initWithWindowNibName:@"DetailsPanel"];
|
||||
[self window]; //So the detailsTable is initialized.
|
||||
py = [[PyDetailsPanel alloc] initWithModel:findHackishModel(@"details_panel")];
|
||||
[py bindCallback:createCallback(@"DetailsPanelView", self)];
|
||||
[py connect];
|
||||
model = [[PyDetailsPanel alloc] initWithModel:aPyRef];
|
||||
[model bindCallback:createCallback(@"DetailsPanelView", self)];
|
||||
[model connect];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[py disconnect];
|
||||
[py release];
|
||||
[model disconnect];
|
||||
[model release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (PyDetailsPanel *)py
|
||||
- (PyDetailsPanel *)model
|
||||
{
|
||||
return (PyDetailsPanel *)py;
|
||||
return (PyDetailsPanel *)model;
|
||||
}
|
||||
|
||||
- (void)refreshDetails
|
||||
@ -56,12 +56,12 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
/* NSTableView Delegate */
|
||||
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
|
||||
{
|
||||
return [[self py] numberOfRows];
|
||||
return [[self model] numberOfRows];
|
||||
}
|
||||
|
||||
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)column row:(NSInteger)row
|
||||
{
|
||||
return [[self py] valueForColumn:[column identifier] row:row];
|
||||
return [[self model] valueForColumn:[column identifier] row:row];
|
||||
}
|
||||
|
||||
/* Python --> Cocoa */
|
||||
|
@ -7,12 +7,13 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <Python.h>
|
||||
#import "HSOutline.h"
|
||||
#import "PyDirectoryOutline.h"
|
||||
|
||||
#define DGAddedFoldersNotification @"DGAddedFoldersNotification"
|
||||
|
||||
@interface DirectoryOutline : HSOutline {}
|
||||
- (id)initWithOutlineView:(HSOutlineView *)aOutlineView;
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef outlineView:(HSOutlineView *)aOutlineView;
|
||||
- (PyDirectoryOutline *)py;
|
||||
@end;
|
@ -10,9 +10,9 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation DirectoryOutline
|
||||
- (id)initWithOutlineView:(HSOutlineView *)aOutlineView
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef outlineView:(HSOutlineView *)aOutlineView
|
||||
{
|
||||
PyDirectoryOutline *model = [[PyDirectoryOutline alloc] initWithModel:findHackishModel(@"directory_tree")];
|
||||
PyDirectoryOutline *model = [[PyDirectoryOutline alloc] initWithModel:aPyRef];
|
||||
self = [super initWithPy:model view:aOutlineView];
|
||||
[model bindCallback:createCallback(@"DirectoryOutlineView", self)];
|
||||
[model release];
|
||||
|
@ -24,7 +24,7 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
[self fillPopUpMenu];
|
||||
_recentDirectories = [[HSRecentFiles alloc] initWithName:@"recentDirectories" menu:[addButtonPopUp menu]];
|
||||
[_recentDirectories setDelegate:self];
|
||||
outline = [[DirectoryOutline alloc] initWithOutlineView:outlineView];
|
||||
outline = [[DirectoryOutline alloc] initWithPyRef:[model directoryTree] outlineView:outlineView];
|
||||
[self refreshRemoveButtonText];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(directorySelectionChanged:)
|
||||
name:NSOutlineViewSelectionDidChangeNotification object:outlineView];
|
||||
|
@ -13,11 +13,11 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
{
|
||||
IBOutlet NSButton *continueButton;
|
||||
|
||||
PyExtraFairwareReminder *py;
|
||||
PyExtraFairwareReminder *model;
|
||||
NSTimer *timer;
|
||||
}
|
||||
- (id)init;
|
||||
- (PyExtraFairwareReminder *)py;
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef;
|
||||
- (PyExtraFairwareReminder *)model;
|
||||
|
||||
- (void)start;
|
||||
- (void)updateButton;
|
||||
|
@ -10,36 +10,36 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation ExtraFairwareReminder
|
||||
- (id)init
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef
|
||||
{
|
||||
self = [super initWithWindowNibName:@"ExtraFairwareReminder"];
|
||||
[self window];
|
||||
[continueButton setEnabled:NO];
|
||||
py = [[PyExtraFairwareReminder alloc] initWithModel:findHackishModel(@"extra_fairware_reminder")];
|
||||
[py bindCallback:createCallback(@"ExtraFairwareReminderView", self)];
|
||||
model = [[PyExtraFairwareReminder alloc] initWithModel:aPyRef];
|
||||
[model bindCallback:createCallback(@"ExtraFairwareReminderView", self)];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[py release];
|
||||
[model release];
|
||||
[timer release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (PyExtraFairwareReminder *)py
|
||||
- (PyExtraFairwareReminder *)model
|
||||
{
|
||||
return (PyExtraFairwareReminder *)py;
|
||||
return (PyExtraFairwareReminder *)model;
|
||||
}
|
||||
|
||||
- (void)start
|
||||
{
|
||||
[[self py] start];
|
||||
[[self model] start];
|
||||
}
|
||||
|
||||
- (void)updateButton
|
||||
{
|
||||
[[self py] updateButton];
|
||||
[[self model] updateButton];
|
||||
}
|
||||
|
||||
- (IBAction)continue:(id)sender
|
||||
|
@ -18,13 +18,13 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
IBOutlet NSTableView *criteriaTableView;
|
||||
IBOutlet NSTableView *prioritizationTableView;
|
||||
|
||||
PyPrioritizeDialog *py;
|
||||
PyPrioritizeDialog *model;
|
||||
HSPopUpList *categoryPopUp;
|
||||
HSSelectableList *criteriaList;
|
||||
PrioritizeList *prioritizationList;
|
||||
}
|
||||
- (id)init;
|
||||
- (PyPrioritizeDialog *)py;
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef;
|
||||
- (PyPrioritizeDialog *)model;
|
||||
|
||||
- (IBAction)addSelected:(id)sender;
|
||||
- (IBAction)removeSelected:(id)sender;
|
||||
|
@ -10,41 +10,42 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation PrioritizeDialog
|
||||
- (id)init
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef
|
||||
{
|
||||
self = [super initWithWindowNibName:@"PrioritizeDialog"];
|
||||
[self window];
|
||||
py = [[PyPrioritizeDialog alloc] initWithModel:findHackishModel(@"prioritize_dialog")];
|
||||
[py bindCallback:createCallback(@"PrioritizeDialogView", self)];
|
||||
categoryPopUp = [[HSPopUpList alloc] initWithPyRef:[[self py] categoryList] popupView:categoryPopUpView];
|
||||
criteriaList = [[HSSelectableList alloc] initWithPyRef:[[self py] criteriaList] tableView:criteriaTableView];
|
||||
prioritizationList = [[PrioritizeList alloc] initWithPyRef:[[self py] prioritizationList] tableView:prioritizationTableView];
|
||||
[py connect];
|
||||
model = [[PyPrioritizeDialog alloc] initWithModel:aPyRef];
|
||||
[model bindCallback:createCallback(@"PrioritizeDialogView", self)];
|
||||
categoryPopUp = [[HSPopUpList alloc] initWithPyRef:[[self model] categoryList] popupView:categoryPopUpView];
|
||||
criteriaList = [[HSSelectableList alloc] initWithPyRef:[[self model] criteriaList] tableView:criteriaTableView];
|
||||
prioritizationList = [[PrioritizeList alloc] initWithPyRef:[[self model] prioritizationList] tableView:prioritizationTableView];
|
||||
[model connect];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[py disconnect];
|
||||
[model disconnect];
|
||||
[categoryPopUp release];
|
||||
[criteriaList release];
|
||||
[prioritizationList release];
|
||||
[model release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (PyPrioritizeDialog *)py
|
||||
- (PyPrioritizeDialog *)model
|
||||
{
|
||||
return (PyPrioritizeDialog *)py;
|
||||
return (PyPrioritizeDialog *)model;
|
||||
}
|
||||
|
||||
- (IBAction)addSelected:(id)sender
|
||||
{
|
||||
[[self py] addSelected];
|
||||
[[self model] addSelected];
|
||||
}
|
||||
|
||||
- (IBAction)removeSelected:(id)sender
|
||||
{
|
||||
[[self py] removeSelected];
|
||||
[[self model] removeSelected];
|
||||
}
|
||||
|
||||
- (IBAction)ok:(id)sender
|
||||
|
@ -17,7 +17,7 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
PyProblemDialog *model;
|
||||
HSTable *problemTable;
|
||||
}
|
||||
- (id)init;
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef;
|
||||
|
||||
- (void)initializeColumns;
|
||||
- (IBAction)revealSelected:(id)sender;
|
||||
|
@ -10,11 +10,11 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation ProblemDialog
|
||||
- (id)init
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef
|
||||
{
|
||||
self = [super initWithWindowNibName:@"ProblemDialog"];
|
||||
[self window]; //So the detailsTable is initialized.
|
||||
model = [[PyProblemDialog alloc] initWithModel:findHackishModel(@"problem_dialog")];
|
||||
model = [[PyProblemDialog alloc] initWithModel:aPyRef];
|
||||
problemTable = [[HSTable alloc] initWithPyRef:[model problemTable] tableView:problemTableView];
|
||||
[self initializeColumns];
|
||||
[model connect];
|
||||
|
@ -15,7 +15,7 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
{
|
||||
NSSet *_deltaColumns;
|
||||
}
|
||||
- (id)initWithView:(NSTableView *)aTableView;
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef view:(NSTableView *)aTableView;
|
||||
- (PyResultTable *)model;
|
||||
- (BOOL)powerMarkerMode;
|
||||
- (void)setPowerMarkerMode:(BOOL)aPowerMarkerMode;
|
||||
|
@ -18,9 +18,9 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
@end
|
||||
|
||||
@implementation ResultTable
|
||||
- (id)initWithView:(NSTableView *)aTableView;
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef view:(NSTableView *)aTableView
|
||||
{
|
||||
PyResultTable *m = [[PyResultTable alloc] initWithModel:findHackishModel(@"result_table")];
|
||||
PyResultTable *m = [[PyResultTable alloc] initWithModel:aPyRef];
|
||||
self = [super initWithModel:m tableView:aTableView];
|
||||
[m bindCallback:createCallback(@"ResultTableView", self)];
|
||||
[m release];
|
||||
|
@ -24,9 +24,9 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
columnsMenu = [app columnsMenu];
|
||||
/* Put a cute iTunes-like bottom bar */
|
||||
[[self window] setContentBorderThickness:28 forEdge:NSMinYEdge];
|
||||
table = [[ResultTable alloc] initWithView:matches];
|
||||
statsLabel = [[StatsLabel alloc] initWithLabelView:stats];
|
||||
problemDialog = [[ProblemDialog alloc] init];
|
||||
table = [[ResultTable alloc] initWithPyRef:[model resultTable] view:matches];
|
||||
statsLabel = [[StatsLabel alloc] initWithPyRef:[model statsLabel] view:stats];
|
||||
problemDialog = [[ProblemDialog alloc] initWithPyRef:[model problemDialog]];
|
||||
[self initResultColumns];
|
||||
[self fillColumnsMenu];
|
||||
[matches setTarget:self];
|
||||
@ -272,10 +272,10 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
- (IBAction)reprioritizeResults:(id)sender
|
||||
{
|
||||
PrioritizeDialog *dlg = [[PrioritizeDialog alloc] init];
|
||||
PrioritizeDialog *dlg = [[PrioritizeDialog alloc] initWithPyRef:[model prioritizeDialog]];
|
||||
NSInteger result = [NSApp runModalForWindow:[dlg window]];
|
||||
if (result == NSRunStoppedResponse) {
|
||||
[[dlg py] performReprioritization];
|
||||
[[dlg model] performReprioritization];
|
||||
}
|
||||
[dlg release];
|
||||
[[self window] makeKeyAndOrderFront:nil];
|
||||
|
@ -7,13 +7,11 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "HSGUIController.h"
|
||||
#import "PyStatsLabel.h"
|
||||
|
||||
@interface StatsLabel : NSObject {
|
||||
PyStatsLabel *py;
|
||||
NSTextField *view;
|
||||
}
|
||||
- (id)initWithLabelView:(NSTextField *)aLabelView;
|
||||
- (PyStatsLabel *)py;
|
||||
@interface StatsLabel : HSGUIController {}
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef view:(NSTextField *)aLabelView;
|
||||
- (PyStatsLabel *)model;
|
||||
- (NSTextField *)labelView;
|
||||
@end
|
@ -10,27 +10,27 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation StatsLabel
|
||||
- (id)initWithLabelView:(NSTextField *)aLabelView
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef view:(NSTextField *)aLabelView
|
||||
{
|
||||
self = [self init];
|
||||
view = [aLabelView retain];
|
||||
py = [[PyStatsLabel alloc] initWithModel:findHackishModel(@"stats_label")];
|
||||
[py bindCallback:createCallback(@"StatsLabelView", self)];
|
||||
[[self py] connect];
|
||||
PyStatsLabel *m = [[PyStatsLabel alloc] initWithModel:aPyRef];
|
||||
self = [self initWithModel:m view:aLabelView];
|
||||
[m bindCallback:createCallback(@"StatsLabelView", self)];
|
||||
[m connect];
|
||||
[m release];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[self py] disconnect];
|
||||
[py release];
|
||||
[[self model] disconnect];
|
||||
[model release];
|
||||
[view release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (PyStatsLabel *)py
|
||||
- (PyStatsLabel *)model
|
||||
{
|
||||
return (PyStatsLabel *)py;
|
||||
return (PyStatsLabel *)model;
|
||||
}
|
||||
|
||||
- (NSTextField *)labelView
|
||||
@ -41,6 +41,6 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
/* Python --> Cocoa */
|
||||
- (void)refresh
|
||||
{
|
||||
[[self labelView] setStringValue:[[self py] display]];
|
||||
[[self labelView] setStringValue:[[self model] display]];
|
||||
}
|
||||
@end
|
||||
|
@ -4,7 +4,7 @@ from objp.util import pyref, dontwrap
|
||||
from jobprogress import job
|
||||
import cocoa
|
||||
from cocoa import install_exception_hook, proxy
|
||||
from cocoa.inter2 import PyFairware, FairwareView
|
||||
from cocoa.inter import PyFairware, FairwareView
|
||||
from hscommon.trans import trget
|
||||
|
||||
from core.app import JobType
|
||||
@ -45,6 +45,9 @@ class PyDupeGuruBase(PyFairware):
|
||||
def prioritizeDialog(self) -> pyref:
|
||||
return self.model.prioritize_dialog
|
||||
|
||||
def problemDialog(self) -> pyref:
|
||||
return self.model.problem_dialog
|
||||
|
||||
def statsLabel(self) -> pyref:
|
||||
return self.model.stats_label
|
||||
|
||||
|
@ -76,8 +76,6 @@ class DupeGuru(DupeGuruBase):
|
||||
class PyDupeGuru(PyDupeGuruBase):
|
||||
def __init__(self):
|
||||
self._init(DupeGuru)
|
||||
import __main__
|
||||
__main__.APP_INSTANCE = self.model
|
||||
|
||||
#---Properties
|
||||
def setMinMatchPercentage_(self, percentage: int):
|
||||
|
@ -1,4 +1,4 @@
|
||||
from cocoa.inter2 import PyGUIObject, GUIObjectView
|
||||
from cocoa.inter import PyGUIObject, GUIObjectView
|
||||
|
||||
class DetailsPanelView(GUIObjectView):
|
||||
pass
|
||||
|
@ -1,5 +1,5 @@
|
||||
from objp.util import dontwrap
|
||||
from cocoa.inter2 import PyOutline, GUIObjectView
|
||||
from cocoa.inter import PyOutline, GUIObjectView
|
||||
|
||||
class DirectoryOutlineView(GUIObjectView):
|
||||
pass
|
||||
|
@ -1,5 +1,5 @@
|
||||
from objp.util import dontwrap
|
||||
from cocoa.inter2 import PyGUIObject
|
||||
from cocoa.inter import PyGUIObject
|
||||
|
||||
class ExtraFairwareReminderView:
|
||||
def startTimer(self): pass
|
||||
|
@ -1,5 +1,5 @@
|
||||
from objp.util import pyref
|
||||
from cocoa.inter2 import PyGUIObject, GUIObjectView
|
||||
from cocoa.inter import PyGUIObject, GUIObjectView
|
||||
|
||||
class PrioritizeDialogView(GUIObjectView):
|
||||
pass
|
||||
|
@ -1,4 +1,4 @@
|
||||
from cocoa.inter2 import PySelectableList, SelectableListView
|
||||
from cocoa.inter import PySelectableList, SelectableListView
|
||||
|
||||
class PrioritizeListView(SelectableListView):
|
||||
pass
|
||||
|
@ -1,5 +1,5 @@
|
||||
from objp.util import pyref
|
||||
from cocoa.inter2 import PyGUIObject
|
||||
from cocoa.inter import PyGUIObject
|
||||
|
||||
class PyProblemDialog(PyGUIObject):
|
||||
def problemTable(self) -> pyref:
|
||||
|
@ -1,5 +1,5 @@
|
||||
from objp.util import dontwrap
|
||||
from cocoa.inter2 import PyTable, TableView
|
||||
from cocoa.inter import PyTable, TableView
|
||||
|
||||
class ResultTableView(TableView):
|
||||
def invalidateMarkings(self): pass
|
||||
|
@ -1,4 +1,4 @@
|
||||
from cocoa.inter2 import PyGUIObject, GUIObjectView
|
||||
from cocoa.inter import PyGUIObject, GUIObjectView
|
||||
|
||||
class StatsLabelView(GUIObjectView):
|
||||
pass
|
||||
|
@ -7,7 +7,7 @@
|
||||
from hscommon.trans import install_gettext_trans_under_cocoa
|
||||
install_gettext_trans_under_cocoa()
|
||||
|
||||
from cocoa.inter2 import PySelectableList, PyColumns, PyTable
|
||||
from cocoa.inter import PySelectableList, PyColumns, PyTable
|
||||
|
||||
from inter.details_panel import PyDetailsPanel
|
||||
from inter.directory_outline import PyDirectoryOutline
|
||||
|
Loading…
x
Reference in New Issue
Block a user