Fixed a bug where re-prioritization criteria list would initially be empty.

That was because the dialog was created on launch time rather than on-the-fly.

--HG--
branch : objp
This commit is contained in:
Virgil Dupras 2012-01-15 17:24:30 -05:00
parent 29796e87b7
commit baa2177439
6 changed files with 10 additions and 9 deletions

View File

@ -11,6 +11,7 @@ http://www.hardcoded.net/licenses/bsd_license
#import "HSPopUpList.h"
#import "HSSelectableList.h"
#import "PrioritizeList.h"
#import "PyDupeGuru.h"
@interface PrioritizeDialog : NSWindowController
{
@ -23,7 +24,7 @@ http://www.hardcoded.net/licenses/bsd_license
HSSelectableList *criteriaList;
PrioritizeList *prioritizationList;
}
- (id)initWithPyRef:(PyObject *)aPyRef;
- (id)initWithApp:(PyDupeGuru *)aApp;
- (PyPrioritizeDialog *)model;
- (IBAction)addSelected:(id)sender;

View File

@ -10,11 +10,11 @@ http://www.hardcoded.net/licenses/bsd_license
#import "Utils.h"
@implementation PrioritizeDialog
- (id)initWithPyRef:(PyObject *)aPyRef
- (id)initWithApp:(PyDupeGuru *)aApp
{
self = [super initWithWindowNibName:@"PrioritizeDialog"];
[self window];
model = [[PyPrioritizeDialog alloc] initWithModel:aPyRef];
model = [[PyPrioritizeDialog alloc] initWithApp:[aApp pyRef]];
[model bindCallback:createCallback(@"PrioritizeDialogView", self)];
categoryPopUp = [[HSPopUpList alloc] initWithPyRef:[[self model] categoryList] popupView:categoryPopUpView];
criteriaList = [[HSSelectableList alloc] initWithPyRef:[[self model] criteriaList] tableView:criteriaTableView];

View File

@ -272,7 +272,7 @@ http://www.hardcoded.net/licenses/bsd_license
- (IBAction)reprioritizeResults:(id)sender
{
PrioritizeDialog *dlg = [[PrioritizeDialog alloc] initWithPyRef:[model prioritizeDialog]];
PrioritizeDialog *dlg = [[PrioritizeDialog alloc] initWithApp:model];
NSInteger result = [NSApp runModalForWindow:[dlg window]];
if (result == NSRunStoppedResponse) {
[[dlg model] performReprioritization];

View File

@ -43,9 +43,6 @@ class PyDupeGuruBase(PyFairware):
def extraFairwareReminder(self) -> pyref:
return self.model.extra_fairware_reminder
def prioritizeDialog(self) -> pyref:
return self.model.prioritize_dialog
def problemDialog(self) -> pyref:
return self.model.problem_dialog

View File

@ -1,10 +1,15 @@
from objp.util import pyref
from cocoa.inter import PyGUIObject, GUIObjectView
from core.gui.prioritize_dialog import PrioritizeDialog
class PrioritizeDialogView(GUIObjectView):
pass
class PyPrioritizeDialog(PyGUIObject):
def __init__(self, app: pyref):
model = PrioritizeDialog(app.model)
PyGUIObject.__init__(self, model)
def categoryList(self) -> pyref:
return self.model.category_list

View File

@ -27,7 +27,6 @@ from . import directories, results, scanner, export, fs
from .gui.details_panel import DetailsPanel
from .gui.directory_tree import DirectoryTree
from .gui.extra_fairware_reminder import ExtraFairwareReminder
from .gui.prioritize_dialog import PrioritizeDialog
from .gui.problem_dialog import ProblemDialog
from .gui.stats_label import StatsLabel
@ -109,7 +108,6 @@ class DupeGuru(RegistrableApplication, Broadcaster):
self.details_panel = DetailsPanel(self)
self.directory_tree = DirectoryTree(self)
self.extra_fairware_reminder = ExtraFairwareReminder(self)
self.prioritize_dialog = PrioritizeDialog(self)
self.problem_dialog = ProblemDialog(self)
self.stats_label = StatsLabel(self)
self.result_table = self._create_result_table()