mirror of
https://github.com/markqvist/Sideband.git
synced 2025-11-30 12:16:53 -05:00
Consistent pane close event handling
This commit is contained in:
parent
fc9e1bf86f
commit
2fe1527ba2
2 changed files with 42 additions and 66 deletions
|
|
@ -81,13 +81,14 @@ class Utilities():
|
|||
### rnstatus screen
|
||||
######################################
|
||||
|
||||
def rnstatus_action(self, sender=None):
|
||||
def rnstatus_action(self, sender=None, from_conversations=False):
|
||||
if not self.app.root.ids.screen_manager.has_screen("rnstatus_screen"):
|
||||
self.rnstatus_screen = Builder.load_string(layout_rnstatus_screen)
|
||||
self.rnstatus_screen.app = self.app
|
||||
self.rnstatus_screen.delegate = self
|
||||
self.app.root.ids.screen_manager.add_widget(self.rnstatus_screen)
|
||||
|
||||
self.rnstatus_screen.from_conversations = from_conversations
|
||||
self.app.root.ids.screen_manager.transition.direction = "left"
|
||||
self.app.root.ids.screen_manager.current = "rnstatus_screen"
|
||||
self.app.sideband.setstate("app.displaying", self.app.root.ids.screen_manager.current)
|
||||
|
|
@ -97,6 +98,10 @@ class Utilities():
|
|||
def update_rnstatus(self, sender=None):
|
||||
threading.Thread(target=self.update_rnstatus_job, daemon=True).start()
|
||||
|
||||
def close_rnstatus_action(self, sender=None):
|
||||
if not self.rnstatus_screen.from_conversations: self.app.close_sub_utilities_action()
|
||||
else: self.app.close_any_action()
|
||||
|
||||
def update_rnstatus_job(self, sender=None):
|
||||
if self.rnstatus_instance == None:
|
||||
import RNS.Utilities.rnstatus as rnstatus
|
||||
|
|
@ -319,7 +324,7 @@ MDScreen:
|
|||
right_action_items:
|
||||
[
|
||||
# ['refresh', lambda x: root.delegate.update_rnstatus()],
|
||||
['close', lambda x: root.app.close_sub_utilities_action(self)],
|
||||
['close', lambda x: root.delegate.close_rnstatus_action(self)],
|
||||
]
|
||||
|
||||
MDScrollView:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue