mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-09 13:24:35 +00:00
Updated cocoalib subtree.
This commit is contained in:
parent
d874f26f06
commit
8e15d89a2e
@ -243,6 +243,38 @@ class PyTable(PyGUIObject):
|
||||
def update_selection(self):
|
||||
self.callback.updateSelection()
|
||||
|
||||
class ProgressWindowView(GUIObjectView):
|
||||
def setProgress_(self, progress: int): pass
|
||||
def showWindow(self): pass
|
||||
def closeWindow(self): pass
|
||||
|
||||
class PyProgressWindow(PyGUIObject):
|
||||
def jobdescTextField(self) -> pyref:
|
||||
return self.model.jobdesc_textfield
|
||||
|
||||
def progressdescTextField(self) -> pyref:
|
||||
return self.model.progressdesc_textfield
|
||||
|
||||
def pulse(self):
|
||||
self.model.pulse()
|
||||
|
||||
def cancel(self):
|
||||
self.model.cancel()
|
||||
|
||||
#--- Python -> Cocoa
|
||||
@dontwrap
|
||||
def set_progress(self, last_progress):
|
||||
self.callback.setProgress_(last_progress)
|
||||
|
||||
@dontwrap
|
||||
def show(self):
|
||||
self.callback.showWindow()
|
||||
|
||||
@dontwrap
|
||||
def close(self):
|
||||
self.callback.closeWindow()
|
||||
|
||||
|
||||
class BaseAppView:
|
||||
def showMessage_(self, msg: str): pass
|
||||
|
||||
|
28
cocoalib/controllers/HSProgressWindow.h
Normal file
28
cocoalib/controllers/HSProgressWindow.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
Copyright 2013 Hardcoded Software (http://www.hardcoded.net)
|
||||
|
||||
This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
||||
which should be included with this package. The terms are also available at
|
||||
http://www.hardcoded.net/licenses/bsd_license
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "HSGUIController.h"
|
||||
#import "HSTextField.h"
|
||||
#import "Worker.h"
|
||||
#import "PyProgressWindow.h"
|
||||
|
||||
@interface HSProgressWindow : HSGUIController <Worker>
|
||||
{
|
||||
NSInteger progress;
|
||||
HSTextField *jobdescTextField;
|
||||
HSTextField *progressdescTextField;
|
||||
}
|
||||
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef view:(NSView *)aView;
|
||||
- (PyProgressWindow *)model;
|
||||
|
||||
- (void)setProgress:(NSInteger)aProgress;
|
||||
- (void)showWindow;
|
||||
- (void)closeWindow;
|
||||
@end
|
68
cocoalib/controllers/HSProgressWindow.m
Normal file
68
cocoalib/controllers/HSProgressWindow.m
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright 2013 Hardcoded Software (http://www.hardcoded.net)
|
||||
|
||||
This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
||||
which should be included with this package. The terms are also available at
|
||||
http://www.hardcoded.net/licenses/bsd_license
|
||||
*/
|
||||
|
||||
#import "HSProgressWindow.h"
|
||||
#import "ProgressController.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation HSProgressWindow
|
||||
- (id)initWithPyRef:(PyObject *)aPyRef view:(NSView *)aView
|
||||
{
|
||||
self = [self initWithPyRef:aPyRef wrapperClass:[PyProgressWindow class] callbackClassName:@"ProgressWindowView" view:aView];
|
||||
[[ProgressController mainProgressController] setWorker:self];
|
||||
jobdescTextField = [[HSTextField alloc] initWithPyRef:[[self model] jobdescTextField] view:[[ProgressController mainProgressController] descText]];
|
||||
progressdescTextField = [[HSTextField alloc] initWithPyRef:[[self model] progressdescTextField] view:[[ProgressController mainProgressController] statusText]];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (PyProgressWindow *)model
|
||||
{
|
||||
return (PyProgressWindow *)model;
|
||||
}
|
||||
|
||||
/* Public */
|
||||
- (void)setProgress:(NSInteger)aProgress
|
||||
{
|
||||
progress = aProgress;
|
||||
}
|
||||
|
||||
- (void)showWindow
|
||||
{
|
||||
[[ProgressController mainProgressController] show];
|
||||
}
|
||||
|
||||
- (void)closeWindow
|
||||
{
|
||||
[[ProgressController mainProgressController] hide];
|
||||
}
|
||||
|
||||
/* Worker */
|
||||
|
||||
- (NSNumber *)getJobProgress
|
||||
{
|
||||
[[self model] pulse];
|
||||
return [NSNumber numberWithInt:progress];
|
||||
}
|
||||
|
||||
- (NSString *)getJobDesc
|
||||
{
|
||||
// Our desc label is updated independently.
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)cancelJob
|
||||
{
|
||||
[[self model] cancel];
|
||||
}
|
||||
|
||||
- (void)jobCompleted:(NSString *)jobid
|
||||
{
|
||||
// With the new hscommon.gui.progress_window, this call is done from within the core. Do nothing.
|
||||
}
|
||||
|
||||
@end
|
Loading…
x
Reference in New Issue
Block a user