mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
Converted .h view objp bridge interfaces to python ones. It simplifies them and allows for subclassing.
--HG-- branch : objp
This commit is contained in:
parent
f6dd1a6a42
commit
a699a2ef45
18
build.py
18
build.py
@ -179,18 +179,18 @@ def build_cocoa_bridging_interfaces():
|
|||||||
import objp.p2o
|
import objp.p2o
|
||||||
add_to_pythonpath('cocoa')
|
add_to_pythonpath('cocoa')
|
||||||
add_to_pythonpath('cocoalib')
|
add_to_pythonpath('cocoalib')
|
||||||
from inter.details_panel import PyDetailsPanel
|
from inter.details_panel import PyDetailsPanel, DetailsPanelView
|
||||||
from inter.extra_fairware_reminder import PyExtraFairwareReminder
|
from inter.extra_fairware_reminder import PyExtraFairwareReminder, ExtraFairwareReminderView
|
||||||
from inter.stats_label import PyStatsLabel
|
from inter.stats_label import PyStatsLabel, StatsLabelView
|
||||||
for class_ in [PyDetailsPanel, PyExtraFairwareReminder, PyStatsLabel]:
|
for class_ in [PyDetailsPanel, PyExtraFairwareReminder, PyStatsLabel]:
|
||||||
objp.o2p.generate_objc_code(class_, 'cocoa/autogen')
|
objp.o2p.generate_objc_code(class_, 'cocoa/autogen')
|
||||||
for fn in os.listdir('cocoa/base/bridge'):
|
for class_ in [DetailsPanelView, ExtraFairwareReminderView, StatsLabelView]:
|
||||||
basename = fn[:-2]
|
clsspec = objp.o2p.spec_from_python_class(class_)
|
||||||
header_path = op.join('cocoa/base/bridge', fn)
|
clsname = class_.__name__
|
||||||
extmodule_path = op.join('build', basename + '.m')
|
extmodule_path = op.join('build', clsname + '.m')
|
||||||
objp.p2o.generate_python_proxy_code(header_path, extmodule_path)
|
objp.p2o.generate_python_proxy_code_from_clsspec(clsspec, extmodule_path)
|
||||||
exts = [
|
exts = [
|
||||||
Extension(basename, [extmodule_path, 'build/ObjP.m'],
|
Extension(clsname, [extmodule_path, 'build/ObjP.m'],
|
||||||
extra_link_args=["-framework", "Foundation"]),
|
extra_link_args=["-framework", "Foundation"]),
|
||||||
]
|
]
|
||||||
setup(
|
setup(
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
|
|
||||||
@protocol DetailsPanelView <NSObject>
|
|
||||||
- (void)refresh;
|
|
||||||
@end
|
|
@ -1,8 +0,0 @@
|
|||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
|
|
||||||
@protocol ExtraFairwareReminderView <NSObject>
|
|
||||||
- (void)startTimer;
|
|
||||||
- (void)stopTimer;
|
|
||||||
- (void)setButtonText:(NSString *)text;
|
|
||||||
- (void)enableButton;
|
|
||||||
@end
|
|
@ -1,5 +0,0 @@
|
|||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
|
|
||||||
@protocol StatsLabelView <NSObject>
|
|
||||||
- (void)refresh;
|
|
||||||
@end
|
|
@ -1,4 +1,7 @@
|
|||||||
from cocoa.inter2 import PyGUIObject
|
from cocoa.inter2 import PyGUIObject, GUIObjectView
|
||||||
|
|
||||||
|
class DetailsPanelView(GUIObjectView):
|
||||||
|
pass
|
||||||
|
|
||||||
class PyDetailsPanel(PyGUIObject):
|
class PyDetailsPanel(PyGUIObject):
|
||||||
def numberOfRows(self) -> int:
|
def numberOfRows(self) -> int:
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
|
from objp.util import dontwrap
|
||||||
from cocoa.inter2 import PyGUIObject
|
from cocoa.inter2 import PyGUIObject
|
||||||
|
|
||||||
|
class ExtraFairwareReminderView:
|
||||||
|
def startTimer(self): pass
|
||||||
|
def stopTimer(self): pass
|
||||||
|
def setButtonText_(self, text: str): pass;
|
||||||
|
def enableButton(self): pass
|
||||||
|
|
||||||
class PyExtraFairwareReminder(PyGUIObject):
|
class PyExtraFairwareReminder(PyGUIObject):
|
||||||
def start(self):
|
def start(self):
|
||||||
self.model.start()
|
self.model.start()
|
||||||
@ -8,14 +15,18 @@ class PyExtraFairwareReminder(PyGUIObject):
|
|||||||
self.model.update_button()
|
self.model.update_button()
|
||||||
|
|
||||||
# model --> view
|
# model --> view
|
||||||
|
@dontwrap
|
||||||
def start_timer(self):
|
def start_timer(self):
|
||||||
self.callback.startTimer()
|
self.callback.startTimer()
|
||||||
|
|
||||||
|
@dontwrap
|
||||||
def stop_timer(self):
|
def stop_timer(self):
|
||||||
self.callback.stopTimer()
|
self.callback.stopTimer()
|
||||||
|
|
||||||
|
@dontwrap
|
||||||
def enable_button(self):
|
def enable_button(self):
|
||||||
self.callback.enableButton()
|
self.callback.enableButton()
|
||||||
|
|
||||||
|
@dontwrap
|
||||||
def set_button_text(self, text):
|
def set_button_text(self, text):
|
||||||
self.callback.setButtonText_(text)
|
self.callback.setButtonText_(text)
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
from cocoa.inter2 import PyGUIObject
|
from cocoa.inter2 import PyGUIObject, GUIObjectView
|
||||||
|
|
||||||
|
class StatsLabelView(GUIObjectView):
|
||||||
|
pass
|
||||||
|
|
||||||
class PyStatsLabel(PyGUIObject):
|
class PyStatsLabel(PyGUIObject):
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user