Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def on_stop(*l):
if self.modal:
m = self._modal_view
m.remove_widget(self)
Window.remove_widget(m)
Window.remove_widget(self)
if self.exit:
App.get_running_app().stop()
import sys
sys.exit()
else:
App.get_running_app().is_exit = False
def on_stop(*l):
if self.modal:
m = self._modal_view
m.remove_widget(self)
Window.remove_widget(m)
Window.remove_widget(self)
if self.exit:
App.get_running_app().stop()
import sys
sys.exit()
else:
App.get_running_app().is_exit = False
def get_last_results(self):
"""
Gets last rolls & results using pyetheroll lib and updates `roll_logs`
list property.
"""
# lazy loading
from etherscan.client import ConnectionRefused
controller = App.get_running_app().root
account = controller.current_account
if not account:
controller.on_account_none()
self.on_back()
return
self._fetching_results = True
self.toggle_spinner(show=True)
address = "0x" + account.address.hex()
try:
self.roll_logs = self.pyetheroll.get_merged_logs(
address=address)
except ConnectionRefused:
self.on_connection_refused()
self.toggle_spinner(show=False)
self._fetching_results = False
def _change_action_view(self):
app = App.get_running_app()
action_bar = app.root.manager.current_screen.ids.action_bar
_action_view = self.action_view
if (not _action_view) or _action_view.parent:
return
action_bar.clear_widgets()
action_bar.add_widget(_action_view)
def start_services():
"""
Starts both roll polling service and OSC service.
The roll polling service is getting the OSC server connection
parameters so it can communicate to it.
"""
app = App.get_running_app()
osc_server, sockname = OscAppServer.get_or_create(app)
server_address, server_port = sockname
print(sockname)
arguments = {
'osc_server_address': server_address,
'osc_server_port': server_port,
}
start_roll_polling_service(arguments)
def __init__(self, **kwargs):
super(OutputList, self).__init__(**kwargs)
self.app = App.get_running_app() # type: ElectrumWindow
def get_game_info(self):
gi = self.abstractboard.get_gameinfo()
self.gameinfo = gi
self.get_player_details()
self.populate_sgf_model_gameinfo()
try:
print('Trying to remind')
print((App.get_running_app().manager))
print((App.get_running_app().manager.collections_to_refresh))
App.get_running_app().manager.add_collection_refresh_reminder(
self.sgf_model.name)
print('Added collection refresh reminder')
App.get_running_app().manager.homescreen_to_refresh = True
print('Set homescreen refresh reminder')
except AttributeError:
print('Tried to refresh collectionsgf before it was created?')
# try:
def __init__(self, widget):
super(Controller, self).__init__()
self.view = widget
self.settings = kivy.app.App.get_running_app().settings
kivy.app.App.get_running_app().main_widget = widget
self.last_background_url = None # Race condition prevention
self.anim = None # Race condition prevention
# this effectively calls on_next_frame, when the view is ready
Clock.schedule_once(self.on_next_frame, 0)
def on_width(self, instance, width):
"""When the width of the panel is changed, save to the app settings."""
del instance
if self.animating:
return
if width > 0:
app = App.get_running_app()
widthpercent = (width/Window.width)
app.config.set('Settings', 'rightpanel', widthpercent)
if self.hidden:
self.width = 0
content_cancel = Button(text='Cancel', size_hint_y=None, height=40)
content.add_widget(Button(text='Reply'))
content.add_widget(Button(text='Forward'))
content.add_widget(Button(text='Select'))
content.add_widget(Button(text='Delete'))
content.add_widget(content_cancel)
popup = Popup(title='Test popup',
size_hint=(None, None), size=(256, 256),
content=content, disabled=False)
content_cancel.bind(on_release=popup.dismiss)
popup.open()
# expose for unit testing
app = App.get_running_app()
app.message_control = content