def __init__(self, **kw):
"""
Initialization function. We will do the following task (in order):
__[x] means already done in App__
1. [x] Check if the device is rooted
2. [x] Initialize necessary libs required by MobileInsight (e.g., libwireshark)
3. [x] Check if Android's security policy allows MobileInsight to access diagnostic mode.
This is mainly caused by SELinux
4. [x] Create necessary folders on SDcard (e.g., /sdcard/mobileinsight/, /sdcard/mobileinsight/log/)
5. Load built-in and 3rd-party plugins (located in /sdcard/mobileinsight/plugins/)
6. [x] Check if the diagnostic mode is enabled
7. Load configurations from the setting panel (configs stored in /sdcard/.mobileinsight.ini)
"""
super(PluginsScreen, self).__init__(**kw)
self.log_viewer = None
self.plugins_list = get_plugins_list()
self.terminal_stop = None
self.terminal_thread = None
bootup = True
#used to shorten long widget names in popup menu
shortenLabel = CoreLabel(markup = True, text_size = (Window.width/2.5, None), shorten_from = "right", font_size = 70)
#Making and adding widgets to popup menu
for name in self.plugins_list:
widget = Button(id = name, markup = True, halign = "left", valign = "top", on_release = self.callback, background_normal = "", background_color = self.ids.selectButton.background_color)
widget.text_size = (Window.width/2.25, Window.height/4)
self.myLayout.add_widget(widget)
app_path = self.plugins_list[name][0]
if os.path.exists(os.path.join(app_path, "readme.txt")):
with open(os.path.join(app_path, "readme.txt"), 'r') as ff:
my_description = ff.read()
else:
my_description = "no description."
#shortening long widget names and making font size
shortenedName = shortenLabel.shorten(name)
font_size = "60"
if Window.width < 1450:
font_size = "45"
widget.text = "[color=fffafa][size=70]"+ shortenedName + "[/size][size="+ font_size + "]\n"+ my_description+"[/size][/color]"
if bootup:
self.selectedPlugin = name
self.ids.selectButton.text = "Select Plugin"
bootup = False
# register Broadcast Receivers.
self.registerBroadcastReceivers()
评论列表
文章目录