@@ -40,8 +40,8 @@ class App:
4040
4141 def __init__ (self , use_gui = True ):
4242 """create a tkk graphic interface with a main window tk_win"""
43- self .__version__ = "0.11.1 "
44- self ._title = "of 2021-08-09b : 'Script me more !'"
43+ self .__version__ = "0.12.0 "
44+ self ._title = "of 2021-08-14a : 'Pop-up result to .excel !'"
4545 self .conn = None # Baresql database object
4646 self .database_file = ""
4747 self .initialdir = "."
@@ -884,7 +884,7 @@ def bip(c):
884884 self .default_separator = shell_list [1 ]
885885 if shell_list [0 ] in (".once" , ".output" , ".excel" ):
886886 if shell_list [0 ] == ".excel" :
887- shell_list = [".once" , "--bom" , "-x" ]
887+ shell_list = [".once" , "--bom" , "-x" ]
888888 if shell_list [0 ] == ".once" :
889889 self .once_mode , self .init_output = True , True
890890 else :
@@ -901,9 +901,11 @@ def bip(c):
901901 self .output_file = self .output_file .strip ('"' )
902902 if (self .output_file + "" ) == "-x" :
903903 self .x_mode = True
904- ff = tmpf .NamedTemporaryFile (delete = False , suffix = ".csv" )
905- self .output_file = ff .name
906- ff .close
904+ with tmpf .TemporaryFile () as ff :
905+ ff = tmpf .NamedTemporaryFile (
906+ delete = False , suffix = "_sqlite_bro.csv"
907+ )
908+ self .output_file = ff .name
907909 if (self .output_file + "z" )[0 ] == "~" :
908910 self .output_file = os .path .join (
909911 self .home , self .output_file [1 :]
@@ -1049,21 +1051,22 @@ def bip(c):
10491051 initialize = self .init_output ,
10501052 )
10511053 self .once_mode , self .init_output = False , False
1052- if self .x_mode :
1053- os .system (
1054- "start excel.exe "
1055- + self .output_file .replace ("\\ " , "/" )
1056- )
1057- ff = tmpf .NamedTemporaryFile (delete = False , suffix = ".csv" )
1058- self .output_file = ff .name
1059- ff .close
10601054 self .n .add_treeview (
10611055 tab_tk_id ,
10621056 ("qry" , "file" ),
10631057 ((instruction , self .output_file ),),
10641058 "Info" ,
10651059 ".once %s" % self .output_file ,
10661060 )
1061+ if self .x_mode :
1062+ os .system (
1063+ "start excel.exe " + self .output_file .replace ("\\ " , "/" )
1064+ )
1065+ with tmpf .TemporaryFile () as ff :
1066+ ff = tmpf .NamedTemporaryFile (
1067+ delete = False , suffix = "_sqlite_bro.csv"
1068+ )
1069+ self .output_file = ff .name
10671070 else :
10681071 cur = cu .execute (instruction )
10691072 rows = cur .fetchall ()
@@ -2056,6 +2059,7 @@ def _main():
20562059-- .backup FILE Backup DB (default "main") to FILE
20572060-- .cd DIRECTORY Change the working directory to DIRECTORY
20582061-- .dump ?FILE? Render database content as SQL (to FILE if specified)
2062+ -- .excel Display the output of next command in spreadsheet
20592063-- .headers on|off Turn display of headers on or off
20602064-- .import FILE TABLE Import data from FILE into TABLE
20612065-- (create TABLE only if it doesn't exist, keep existing records)
0 commit comments