#NEWLINE# def __init__( self , parent , openType , filesource , filenames , title , colHeader , showAltViewButton = False ) : #NEWLINE# #INDENT# if isinstance ( parent , Cntlr ) : #NEWLINE# #INDENT# cntlr = parent #NEWLINE# parent = parent . parent #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cntlr = parent . cntlr #NEWLINE# #UNINDENT# super ( DialogOpenArchive , self ) . __init__ ( parent ) #NEWLINE# self . parent = parent #NEWLINE# self . showAltViewButton = showAltViewButton #NEWLINE# parentGeometry = re . match ( '(\\d+)x(\\d+)[+]?([-]?\\d+)[+]?([-]?\\d+)' , parent . geometry ( ) ) #NEWLINE# dialogX = int ( parentGeometry . group ( 3 ) ) #NEWLINE# dialogY = int ( parentGeometry . group ( 4 ) ) #NEWLINE# self . accepted = False #NEWLINE# self . transient ( self . parent ) #NEWLINE# frame = Frame ( self ) #NEWLINE# treeFrame = Frame ( frame , width = 500 ) #NEWLINE# vScrollbar = Scrollbar ( treeFrame , orient = VERTICAL ) #NEWLINE# hScrollbar = Scrollbar ( treeFrame , orient = HORIZONTAL ) #NEWLINE# self . treeView = Treeview ( treeFrame , xscrollcommand = hScrollbar . set , yscrollcommand = vScrollbar . set ) #NEWLINE# self . treeView . grid ( row = 0 , column = 0 , sticky = ( N , S , E , W ) ) #NEWLINE# hScrollbar [ 'command' ] = self . treeView . xview #NEWLINE# hScrollbar . grid ( row = 1 , column = 0 , sticky = ( E , W ) ) #NEWLINE# vScrollbar [ 'command' ] = self . treeView . yview #NEWLINE# vScrollbar . grid ( row = 0 , column = 1 , sticky = ( N , S ) ) #NEWLINE# treeFrame . columnconfigure ( 0 , weight = 1 ) #NEWLINE# treeFrame . rowconfigure ( 0 , weight = 1 ) #NEWLINE# treeFrame . grid ( row = 0 , column = 0 , columnspan = 4 , sticky = ( N , S , E , W ) , padx = 3 , pady = 3 ) #NEWLINE# self . treeView . focus_set ( ) #NEWLINE# if ( openType != PLUGIN ) : #NEWLINE# #INDENT# cntlr . showStatus ( _ ( 'loading archive {0}' ) . format ( filesource . url ) ) #NEWLINE# #UNINDENT# self . filesource = filesource #NEWLINE# self . filenames = filenames #NEWLINE# self . selection = filesource . selection #NEWLINE# self . hasToolTip = False #NEWLINE# selectedNode = None #NEWLINE# if ( openType == ENTRY_POINTS ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# metadataFiles = filesource . taxonomyPackageMetadataFiles #NEWLINE# ' take first for now\n                if len(metadataFiles) != 1:\n                    raise IOError(_("Taxonomy package contained more than one metadata file: {0}.")\n                                  .format(\', \'.join(metadataFiles)))\n                ' #NEWLINE# metadataFile = metadataFiles [ 0 ] #NEWLINE# metadata = ( ( filesource . url + os . sep ) + metadataFile ) #NEWLINE# self . metadataFilePrefix = os . sep . join ( os . path . split ( metadataFile ) [ : ( - 1 ) ] ) #NEWLINE# if self . metadataFilePrefix : #NEWLINE# #INDENT# self . metadataFilePrefix += '/' #NEWLINE# #UNINDENT# self . taxonomyPkgMetaInf = '{}/META-INF/' . format ( os . path . splitext ( os . path . basename ( filesource . url ) ) [ 0 ] ) #NEWLINE# self . taxonomyPackage = parsePackage ( cntlr , filesource , metadata , ( os . sep . join ( os . path . split ( metadata ) [ : ( - 1 ) ] ) + os . sep ) ) #NEWLINE# if ( not self . taxonomyPackage [ 'nameToUrls' ] ) : #NEWLINE# #INDENT# openType = ARCHIVE #NEWLINE# self . showAltViewButton = False #NEWLINE# #UNINDENT# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# self . close ( ) #NEWLINE# err = _ ( 'Failed to parse metadata; the underlying error was: {0}' ) . format ( e ) #NEWLINE# messagebox . showerror ( _ ( 'Malformed taxonomy package' ) , err ) #NEWLINE# cntlr . addToLog ( err ) #NEWLINE# return #NEWLINE# #UNINDENT# #UNINDENT# if ( openType != PLUGIN ) : #NEWLINE# #INDENT# cntlr . showStatus ( None ) #NEWLINE# #UNINDENT# if ( openType in ( DISCLOSURE_SYSTEM , PLUGIN ) ) : #NEWLINE# #INDENT# y = 3 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# y = 1 #NEWLINE# #UNINDENT# okButton = Button ( frame , text = _ ( 'OK' ) , command = self . ok ) #NEWLINE# cancelButton = Button ( frame , text = _ ( 'Cancel' ) , command = self . close ) #NEWLINE# okButton . grid ( row = y , column = 2 , sticky = ( S , E , W ) , pady = 3 ) #NEWLINE# cancelButton . grid ( row = y , column = 3 , sticky = ( S , E , W ) , pady = 3 , padx = 3 ) #NEWLINE# if self . showAltViewButton : #NEWLINE# #INDENT# self . altViewButton = Button ( frame , command = self . showAltView ) #NEWLINE# self . altViewButton . grid ( row = y , column = 0 , sticky = ( S , W ) , pady = 3 , padx = 3 ) #NEWLINE# #UNINDENT# self . loadTreeView ( openType , colHeader , title ) #NEWLINE# self . geometry ( '+{0}+{1}' . format ( ( dialogX + 50 ) , ( dialogY + 100 ) ) ) #NEWLINE# frame . grid ( row = 0 , column = 0 , sticky = ( N , S , E , W ) ) #NEWLINE# frame . columnconfigure ( 0 , weight = 1 ) #NEWLINE# frame . rowconfigure ( 0 , weight = 1 ) #NEWLINE# window = self . winfo_toplevel ( ) #NEWLINE# window . columnconfigure ( 0 , weight = 1 ) #NEWLINE# window . rowconfigure ( 0 , weight = 1 ) #NEWLINE# self . bind ( '<Return>' , self . ok ) #NEWLINE# self . bind ( '<Escape>' , self . close ) #NEWLINE# self . toolTipText = StringVar ( ) #NEWLINE# if self . hasToolTip : #NEWLINE# #INDENT# self . treeView . bind ( '<Motion>' , self . motion , '+' ) #NEWLINE# self . treeView . bind ( '<Leave>' , self . leave , '+' ) #NEWLINE# self . toolTipText = StringVar ( ) #NEWLINE# self . toolTip = ToolTip ( self . treeView , textvariable = self . toolTipText , wraplength = 640 , follow_mouse = True , state = 'disabled' ) #NEWLINE# self . toolTipRowId = None #NEWLINE# #UNINDENT# self . protocol ( 'WM_DELETE_WINDOW' , self . close ) #NEWLINE# self . grab_set ( ) #NEWLINE# self . wait_window ( self )