<s> import cefpython3 . wx . chromectrl as chrome <EOL> import wx <EOL> import wx . lib . agw . flatnotebook as fnb <EOL> import platform <EOL> import sys <EOL> ROOT_NAME = "<STR_LIT>" <EOL> URLS = [ "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] <EOL> class MainFrame ( wx . Frame ) : <EOL> def __init__ ( self ) : <EOL> wx . Frame . __init__ ( self , parent = None , id = wx . ID_ANY , <EOL> title = '<STR_LIT>' , size = ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . initComponents ( ) <EOL> self . layoutComponents ( ) <EOL> self . initEventHandlers ( ) <EOL> if len ( sys . argv ) == <NUM_LIT:2> and sys . argv [ <NUM_LIT:1> ] == "<STR_LIT>" : <EOL> wx . CallLater ( <NUM_LIT> , self . testLaunch ) <EOL> def testLaunch ( self ) : <EOL> print ( "<STR_LIT>" ) <EOL> self . Close ( ) <EOL> def initComponents ( self ) : <EOL> self . tree = wx . TreeCtrl ( self , id = - <NUM_LIT:1> , size = ( <NUM_LIT:200> , - <NUM_LIT:1> ) ) <EOL> self . root = self . tree . AddRoot ( ROOT_NAME ) <EOL> for url in URLS : <EOL> self . tree . AppendItem ( self . root , url ) <EOL> self . tree . Expand ( self . root ) <EOL> self . tabs = fnb . FlatNotebook ( self , wx . ID_ANY , <EOL> agwStyle = fnb . FNB_NODRAG | fnb . FNB_X_ON_TAB ) <EOL> self . tabs . SetWindowStyleFlag ( wx . WANTS_CHARS ) <EOL> def layoutComponents ( self ) : <EOL> sizer = wx . BoxSizer ( wx . HORIZONTAL ) <EOL> sizer . Add ( self . tree , <NUM_LIT:0> , wx . EXPAND ) <EOL> sizer . Add ( self . tabs , <NUM_LIT:1> , wx . EXPAND ) <EOL> self . SetSizer ( sizer ) <EOL> def initEventHandlers ( self ) : <EOL> self . Bind ( wx . EVT_TREE_SEL_CHANGED , self . OnSelChanged , self . tree ) <EOL> self . Bind ( fnb . EVT_FLATNOTEBOOK_PAGE_CLOSING , self . OnPageClosing ) <EOL> self . Bind ( wx . EVT_CLOSE , self . OnClose ) <EOL> def OnSelChanged ( self , event ) : <EOL> self . item = event . GetItem ( ) <EOL> url = self . tree . GetItemText ( self . item ) <EOL> if url and url != ROOT_NAME : <EOL> cefPanel = chrome . ChromeCtrl ( self . tabs , useTimer = True , url = str ( url ) ) <EOL> self . tabs . AddPage ( cefPanel , url ) <EOL> self . tabs . SetSelection ( self . tabs . GetPageCount ( ) - <NUM_LIT:1> ) <EOL> event . Skip ( ) <EOL> def OnPageClosing ( self , event ) : <EOL> print ( "<STR_LIT>" ) <EOL> event . Skip ( ) <EOL> def OnClose ( self , event ) : <EOL> self . Destroy ( ) <EOL> if platform . system ( ) == "<STR_LIT>" : <EOL> chrome . Shutdown ( ) <EOL> wx . GetApp ( ) . Exit ( ) <EOL> class MyApp ( wx . App ) : <EOL> def OnInit ( self ) : <EOL> frame = MainFrame ( ) <EOL> self . SetTopWindow ( frame ) <EOL> frame . Show ( ) <EOL> return True <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> chrome . Initialize ( ) <EOL> if platform . system ( ) == "<STR_LIT>" : <EOL> import time <EOL> time . sleep ( <NUM_LIT:0.5> ) <EOL> print ( '<STR_LIT>' % wx . version ( ) ) <EOL> app = MyApp ( False ) <EOL> app . MainLoop ( ) <EOL> del app <EOL> if platform . system ( ) in [ "<STR_LIT>" , "<STR_LIT>" ] : <EOL> chrome . Shutdown ( ) </s>
