<s> import sys <EOL> import logging <EOL> import wx <EOL> import wx . grid <EOL> import wx . html <EOL> import requests <EOL> from eve_mlp import __version__ <EOL> from eve_mlp . common import * <EOL> from eve_mlp . gui . common import * <EOL> from eve_mlp . login import do_login , LoginFailed <EOL> from eve_mlp . gui . trayicon import TrayIcon <EOL> from eve_mlp . gui . launcher import LauncherPanel <EOL> from eve_mlp . gui . news import NewsPanel <EOL> from eve_mlp . gui . config import ConfigPanel <EOL> from eve_mlp . gui . status import StatusPanel <EOL> log = logging . getLogger ( __name__ ) <EOL> class MainFrame ( wx . Frame ) : <EOL> def __menu ( self ) : <EOL> menu_bar = wx . MenuBar ( ) <EOL> menu = wx . Menu ( ) <EOL> m_exit = menu . Append ( wx . ID_EXIT , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . Bind ( wx . EVT_MENU , self . OnClose , m_exit ) <EOL> menu_bar . Append ( menu , "<STR_LIT>" ) <EOL> menu = wx . Menu ( ) <EOL> m_rempasswd = menu . Append ( <NUM_LIT> , "<STR_LIT>" , "<STR_LIT>" , kind = wx . ITEM_CHECK ) <EOL> self . m_rempasswd = m_rempasswd <EOL> if self . config . settings [ "<STR_LIT>" ] : <EOL> m_rempasswd . Check ( True ) <EOL> self . Bind ( wx . EVT_MENU , self . OnToggleRememberPasswords , m_rempasswd ) <EOL> m_start_tray = menu . Append ( <NUM_LIT> , "<STR_LIT>" , "<STR_LIT>" , kind = wx . ITEM_CHECK ) <EOL> self . m_start_tray = m_start_tray <EOL> if self . config . settings [ "<STR_LIT>" ] : <EOL> m_start_tray . Check ( True ) <EOL> self . Bind ( wx . EVT_MENU , self . OnToggleStartTray , m_start_tray ) <EOL> menu_bar . Append ( menu , "<STR_LIT>" ) <EOL> menu = wx . Menu ( ) <EOL> m_exit = menu . Append ( wx . ID_EXIT , "<STR_LIT>" , "<STR_LIT>" ) <EOL> m_exit = menu . Append ( wx . ID_EXIT , "<STR_LIT>" , "<STR_LIT>" ) <EOL> menu = wx . Menu ( ) <EOL> m_about = menu . Append ( wx . ID_ABOUT , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . Bind ( wx . EVT_MENU , self . OnAbout , m_about ) <EOL> menu_bar . Append ( menu , "<STR_LIT>" ) <EOL> return menu_bar <EOL> def __init_gui ( self , parent ) : <EOL> try : <EOL> import ctypes <EOL> myappid = '<STR_LIT>' <EOL> ctypes . windll . shell32 . SetCurrentProcessExplicitAppUserModelID ( myappid ) <EOL> except Exception as e : <EOL> pass <EOL> wx . Frame . __init__ ( self , parent , - <NUM_LIT:1> , "<STR_LIT>" % __version__ , size = ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . Bind ( wx . EVT_CLOSE , self . OnWinClose ) <EOL> try : <EOL> self . SetIcons ( icon_bundle ( resource ( "<STR_LIT>" ) ) ) <EOL> except Exception as e : <EOL> pass <EOL> self . SetMenuBar ( self . __menu ( ) ) <EOL> self . statusbar = self . CreateStatusBar ( ) <EOL> self . launcher = LauncherPanel ( self , self . config ) <EOL> self . tabs = wx . Notebook ( self ) <EOL> box = wx . BoxSizer ( wx . HORIZONTAL ) <EOL> box . Add ( self . launcher , <NUM_LIT:0> , wx . EXPAND ) <EOL> box . Add ( self . tabs , <NUM_LIT:1> , wx . EXPAND ) <EOL> self . SetSizer ( box ) <EOL> self . Layout ( ) <EOL> self . news_panel = NewsPanel ( self . tabs , "<STR_LIT>" ) <EOL> self . config_panel = ConfigPanel ( self . tabs , self ) <EOL> self . status_panel = StatusPanel ( self . tabs , self ) <EOL> self . help_panel = NewsPanel ( self . tabs , resource ( "<STR_LIT>" ) ) <EOL> self . tabs . AddPage ( self . news_panel , "<STR_LIT>" ) <EOL> self . tabs . AddPage ( self . config_panel , "<STR_LIT>" ) <EOL> self . tabs . AddPage ( self . status_panel , "<STR_LIT>" ) <EOL> self . tabs . AddPage ( self . help_panel , "<STR_LIT>" ) <EOL> show = True <EOL> try : <EOL> self . icon = TrayIcon ( self ) <EOL> if self . config . settings [ "<STR_LIT>" ] : <EOL> log . info ( "<STR_LIT>" ) <EOL> show = False <EOL> except Exception as e : <EOL> log . exception ( "<STR_LIT>" ) <EOL> self . icon = None <EOL> self . status_panel . OnRefresh ( None ) <EOL> if show : <EOL> self . Show ( True ) <EOL> def __init__ ( self , parent ) : <EOL> self . config = Config ( ) <EOL> self . config . load ( ) <EOL> if self . config . settings [ "<STR_LIT>" ] : <EOL> self . config . master_password = get_password ( parent , "<STR_LIT>" ) <EOL> self . config . decrypt_passwords ( ) <EOL> self . __init_gui ( parent ) <EOL> def launch ( self , launch_config ) : <EOL> try : <EOL> token = None <EOL> if launch_config . username and launch_config . password : <EOL> token = do_login ( launch_config . username , launch_config . password ) <EOL> launch ( self . config , launch_config , token ) <EOL> except LoginFailed as e : <EOL> wx . MessageBox ( str ( e ) , "<STR_LIT>" % launch_config . confname , wx . OK | wx . ICON_ERROR ) <EOL> except LaunchFailed as e : <EOL> wx . MessageBox ( str ( e ) , "<STR_LIT>" % launch_config . confname , wx . OK | wx . ICON_ERROR ) <EOL> def OnClose ( self , evt ) : <EOL> self . Close ( ) <EOL> def OnWinClose ( self , evt ) : <EOL> log . info ( "<STR_LIT>" ) <EOL> self . config . encrypt_passwords ( ) <EOL> self . config . save ( ) <EOL> if self . icon : <EOL> self . icon . Destroy ( ) <EOL> self . Destroy ( ) <EOL> def OnToggleRememberPasswords ( self , evt ) : <EOL> self . config . settings [ "<STR_LIT>" ] = self . m_rempasswd . IsChecked ( ) <EOL> if self . config . settings [ "<STR_LIT>" ] : <EOL> self . config . master_password = get_password ( self , "<STR_LIT>" ) <EOL> def OnToggleStartTray ( self , evt ) : <EOL> self . config . settings [ "<STR_LIT>" ] = self . m_start_tray . IsChecked ( ) <EOL> def OnLaunchConfigSelected ( self , idx ) : <EOL> self . config_panel . launch_config_edit . set_launch_config ( self . config . launches [ idx ] ) <EOL> self . tabs . SetSelection ( <NUM_LIT:1> ) <EOL> def OnAbout ( self , evt ) : <EOL> import eve_mlp . common as common <EOL> info = wx . AboutDialogInfo ( ) <EOL> info . SetName ( "<STR_LIT>" ) <EOL> info . SetDescription ( "<STR_LIT>" ) <EOL> info . SetVersion ( __version__ ) <EOL> info . SetCopyright ( "<STR_LIT>" ) <EOL> info . SetWebSite ( "<STR_LIT>" ) <EOL> info . AddDeveloper ( "<STR_LIT>" ) <EOL> try : <EOL> info . SetIcon ( wx . Icon ( resource ( "<STR_LIT>" ) , wx . BITMAP_TYPE_ICO ) ) <EOL> except Exception as e : <EOL> log . exception ( "<STR_LIT>" ) <EOL> try : <EOL> info . SetLicense ( file ( resource ( "<STR_LIT>" ) ) . read ( ) ) <EOL> except Exception as e : <EOL> log . exception ( "<STR_LIT>" ) <EOL> info . SetLicense ( "<STR_LIT>" ) <EOL> wx . AboutBox ( info ) </s>
