Fixed clean_list for all post interactor dialogs

This commit is contained in:
Manuel Cortez 2019-01-31 16:45:05 -06:00
parent 150f9d6c08
commit 2e64e31a8f

View File

@ -38,7 +38,7 @@ class displayPostInteractor(base.baseInteractor):
def clean_list(self, list): def clean_list(self, list):
if not hasattr(self.view, list): if not hasattr(self.view, list):
raise AttributeError("The control is not present in the view.") raise AttributeError("The control is not present in the view.")
getattr(self.view, control).clear() getattr(self.view, list).clear()
def post_deleted(self): def post_deleted(self):
msg = commonMessages.post_deleted() msg = commonMessages.post_deleted()
@ -63,6 +63,8 @@ class displayPostInteractor(base.baseInteractor):
pub.subscribe(self.enable_attachments, self.modulename+"_enable_attachments") pub.subscribe(self.enable_attachments, self.modulename+"_enable_attachments")
pub.subscribe(self.enable_photo_controls, self.modulename+"_enable_photo_controls") pub.subscribe(self.enable_photo_controls, self.modulename+"_enable_photo_controls")
pub.subscribe(self.post_deleted, self.modulename+"_post_deleted") pub.subscribe(self.post_deleted, self.modulename+"_post_deleted")
pub.subscribe(self.clean_list, self.modulename+"_clean_list")
self.view.comments.list.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.on_comment_changed)
def uninstall(self): def uninstall(self):
super(displayPostInteractor, self).uninstall() super(displayPostInteractor, self).uninstall()
@ -72,6 +74,7 @@ class displayPostInteractor(base.baseInteractor):
pub.unsubscribe(self.enable_attachments, self.modulename+"_enable_attachments") pub.unsubscribe(self.enable_attachments, self.modulename+"_enable_attachments")
pub.unsubscribe(self.enable_photo_controls, self.modulename+"_enable_photo_controls") pub.unsubscribe(self.enable_photo_controls, self.modulename+"_enable_photo_controls")
pub.unsubscribe(self.post_deleted, self.modulename+"_post_deleted") pub.unsubscribe(self.post_deleted, self.modulename+"_post_deleted")
pub.unsubscribe(self.clean_list, self.modulename+"_clean_list")
def on_focus(self, *args, **kwargs): def on_focus(self, *args, **kwargs):
item = self.view.comments.get_selected() item = self.view.comments.get_selected()
@ -126,6 +129,11 @@ class displayPostInteractor(base.baseInteractor):
comment = self.view.comments.get_selected() comment = self.view.comments.get_selected()
self.presenter.show_comment(comment) self.presenter.show_comment(comment)
def on_comment_changed(self, *args, **kwargs):
if hasattr(self.presenter, "change_comment"):
comment = self.view.comments.get_selected()
self.presenter.change_comment(comment)
class displayAudioInteractor(base.baseInteractor): class displayAudioInteractor(base.baseInteractor):
def set(self, control, value): def set(self, control, value):