<s> """<STR_LIT>""" <EOL> import platform <EOL> import os <EOL> import sys <EOL> import logging <EOL> logger = logging . getLogger ( __name__ ) <EOL> logging . basicConfig ( level = logging . INFO ) <EOL> OPEN_DIALOG = <NUM_LIT:10> <EOL> FOLDER_DIALOG = <NUM_LIT:20> <EOL> SAVE_DIALOG = <NUM_LIT:30> <EOL> if platform . system ( ) == "<STR_LIT>" : <EOL> import webview . cocoa as gui <EOL> elif platform . system ( ) == "<STR_LIT>" : <EOL> try : <EOL> if not os . environ . get ( '<STR_LIT>' ) : <EOL> import webview . qt as gui <EOL> except Exception as e : <EOL> logger . warning ( "<STR_LIT>" ) <EOL> import_error = True <EOL> else : <EOL> import_error = False <EOL> if import_error or os . environ . get ( '<STR_LIT>' ) : <EOL> try : <EOL> import webview . gtk as gui <EOL> except Exception as e : <EOL> logger . error ( "<STR_LIT>" ) <EOL> raise Exception ( "<STR_LIT>" ) <EOL> elif platform . system ( ) == "<STR_LIT>" : <EOL> import webview . win32 as gui <EOL> else : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> def create_file_dialog ( dialog_type = OPEN_DIALOG , directory = '<STR_LIT>' , allow_multiple = False , save_filename = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> if not os . path . exists ( directory ) : <EOL> directory = '<STR_LIT>' <EOL> return gui . create_file_dialog ( dialog_type , directory , allow_multiple , save_filename ) <EOL> def load_url ( url ) : <EOL> """<STR_LIT>""" <EOL> gui . load_url ( url ) <EOL> def create_window ( title , url , width = <NUM_LIT> , height = <NUM_LIT> , resizable = True , fullscreen = False , min_size = ( <NUM_LIT:200> , <NUM_LIT:100> ) ) : <EOL> """<STR_LIT>""" <EOL> gui . create_window ( _make_unicode ( title ) , _transform_url ( url ) , width , height , resizable , fullscreen , min_size ) <EOL> def destroy_window ( ) : <EOL> """<STR_LIT>""" <EOL> gui . destroy_window ( ) <EOL> def _make_unicode ( string ) : <EOL> """<STR_LIT>""" <EOL> if sys . version < '<STR_LIT:3>' and isinstance ( string , str ) : <EOL> return unicode ( string . decode ( '<STR_LIT:utf-8>' ) ) <EOL> return string <EOL> def _transform_url ( url ) : <EOL> if url . find ( "<STR_LIT::>" ) == - <NUM_LIT:1> : <EOL> return '<STR_LIT>' + os . path . abspath ( url ) <EOL> else : <EOL> return url </s>
