Skip to content

Commit

Permalink
v3
Browse files Browse the repository at this point in the history
  • Loading branch information
samfisherirl committed Jan 14, 2023
1 parent 0b30bbb commit 7f45426
Show file tree
Hide file tree
Showing 29 changed files with 1,115 additions and 191 deletions.
152 changes: 152 additions & 0 deletions GEO11_MM.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
import os
import webview

import run


from time import sleep
from structured import copy_move_setup
import run

###########################################
###########################################

dirname = os.path.dirname(__file__)

###########################################
###########################################

def on_bridge(window):
# Fire the onbridge function which indicates pywebview is ready
window.evaluate_js("if(window.onbridge){window.onbridge();}")




##########################################
#############Javascript_Entry#############
##########################################



class Api:
def importsteam(self):
response = run.importsteam()
return response

def install(self, id):
run.install_process(id)

def printer(self, val):
print(val)
return val


# Api.install('', 63)

# test install above uncomment

##########################################
#############Start Pywebview Html#########
##########################################



api = Api()
window = webview.create_window('GEO11',
'libber\index.html',
js_api=api,
width=1250,
height=900)
webview.start(on_bridge, window)













##################################################
##################1/14/22 below###################
##################################################







# def checker(window):
# pass
# lib = parse.main()
# vals = ''
# for i in lib[0]:
# vals = vals + str(js.javascript(str(i.name), str(i.exe), str(i.path)))

# try:
# elements = window.get_elements('tabler')
# elements[0]['innerHTML'] = vals

# except:
# pass
# # lib = parse.main()
# vals = ''
# for i in lib[0]:
# if i.longpath != 'xxxx':
# val = js.javascript(str(i.name), str(i.exe), str(i.path))
# vals = vals + val

# try:
# elements = window.get_elements('tabler')
# elements[0]['innerHTML'] = vals

# except:
# print('')

# time.sleep(0.1)
# storage = vals

##########################################
##########################################
##########################################


# def importsteam():
# try:
# test = SqL.test()
# insert_html = SqL.initial_retrieve()
# print('log place 1')
# print(insert_html[1])
#
# except:
# lib = parse.main() # parse steam library
# SqL.loop_insert(lib) # save to sql
# insert_html = js.Import.run(lib)
# print("\nError: Database already exists")
# response = {'message': insert_html}
# return response


# def install_process(id):
#
# msgbox("Installing...")
# try:
# install_game = SqL.get_game_details(id)
# except:
# msgbox("Error, game not found")
# if install_game == 1:
# msgbox("this game is already installed")
# else:
# # game_deets[0] = path, [1] = name
# saucedest = move_copy(install_game)
#
# utilities.installer(saucedest[0], saucedest[1])
#
# msgbox("Complete! \nFind the Geo11 Launcher to play. ")

32 changes: 32 additions & 0 deletions Version_3.py/lib/#sqlbuilder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#sqlbuilder

from peewee import *


db = SqliteDatabase('games.db')


class Game(Model):
game = CharField()
exe = CharField()
path = CharField()
longpath = CharField()
i_d = IntegerField()

class Meta:
database = db # This model uses the "people.db" database.


def add_game(game, exe, path, longpath, i_d):
try:
Game.create(game=game, exe=exe, path=path, longpath=longpath, i_d=i_d)
except IntegrityError:
pass

def loop_insert(lib):
for i in lib:
add_game(i.name, i.exe, i.path, i.longpath, i.id)

db.connect()
db.create_tables([Game])

23 changes: 23 additions & 0 deletions Version_3.py/lib/CX-FREEZE_SETUP_SCRIPT.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import sys
from cx_Freeze import setup, Executable


build_exe_options = {
"packages": ["os", "sys"],
"excludes": ["tkinter"],
"includes": ["pysimplegui"] # <-- Include easy_gui
}

base = None
if sys.platform == "win32":
base = "Win32GUI"


setup(
name = "Geo11_MM",
version = "0.1",
description = "My GUI application!",
icon = "C:\\Users\\dower\\Documents\\virtual-reality.ico",
options = {"build_exe": build_exe_options},
executables = [Executable("geo11_mm.py", base=base)])

9 changes: 9 additions & 0 deletions Version_3.py/lib/Untitled-1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Path:
game = 'c'
p = ''

test = Path()

test.p = 'a'

print(test.p)
39 changes: 27 additions & 12 deletions Version_3.py/lib/VParse.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import subprocess
import codecs

import os
import sys
from structured import path
import shutil
import json
import os.path
from lib import settings_test as S
from lib import library_paths as LP
from structured import settingstest as S
from structured import librarypaths as LP
import utilities as U

dir = path.rootfolder()

from pathlib import Path

base_dir = Path(__file__).parent.parent.parent

appinfo = S.appinfo()
directory = S.Dir.dirname()



def verify_vdf_location(directory):
# global appinfo, dirname
Expand All @@ -29,15 +37,22 @@ def verify_vdf_location(directory):
return False


def call_vdfp(directory):
def call_vdfp():
# Joining the directory and the VDFP.exe file.
VDFexe = os.path.join(directory, 'VDFP.exe')
out = os.path.join(directory, 'output.json')
VDFexe = os.path.join(dir, 'VDFP.exe')
with open('appinfo.json', 'w') as f:
f.write(VDFexe)
out = os.path.join(dir, 'output.json')
cmds = [str(VDFexe), str(appinfo), '-p']
val = U.VDFP(cmds)

#print(appinfo)
#result = subprocess.run([VDFexe, appinfo, '-p'], capture_output=True)

result = subprocess.run([VDFexe, appinfo, '-p'], capture_output=True) # , "--pretty", ">output.json"
# It's converting the output of the command to a string.
val = str(result.stdout.strip(), encoding='utf-8')

# val = result
#with open('out.json', 'w') as f:
# f.write(val)
vals = json.loads(val)
list = vals['datasets']
return list
Expand Down Expand Up @@ -175,7 +190,7 @@ def writer(lib, directory):
os.path.remove(log)
os.path.remove(csv)
except:
print("")
print("log4")
with open(log, 'w', encoding='utf-8') as f:
with open(csv, 'w', encoding='utf-8') as g:
f.write('here are your matched paths, next update includes name. ')
Expand Down
77 changes: 77 additions & 0 deletions Version_3.py/lib/callbaseargcmd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
from structured import VParse as V
import os.path
import shutil
import json
import time

import subprocess
global dirname
dirname = os.path.dirname(__file__)
directory = os.path.dirname(__file__)

appinfo = r'C:\Program Files (x86)\Steam\appcache\appinfo.vdf'

def dirnam(path):
global dirname
dirname = path
return dirname
# class Library():
# # profile = data['Datasets'][400]['Data']['appinfo']
# def __init__(self, exe, dir, path, name):
# self.exe = exe
# self.name = name
# self.dir = dir
# # `self` is a reference to the current instance of the class.
# self.path = path

def main():
global dirname
dirname = dirnam(os.path.dirname(__file__))
list = []
# Checking if the appinfo.vdf file is in the directory.
if V.moveV(directory):

time.sleep(0.2)
# Calling the cmd4 function in the VParse.py file.
list = V.cmd4(directory)
gamedic = V.parser(list) # Parsing the list of games and their information.

# Creating a list of objects.
lib = V.constructor(gamedic)
# A list of all the paths to the games.
paths = V.callLibrary(lib)
if paths == False:
print('\n\nNo paths found.')
time.sleep(5)
return
# Checking if the path to the game is valid.
lib = V.pathValidator(paths, lib)
with open('output1.txt', 'w') as f:
f.write(str(lib))
# # Writing the data to a file.
V.writer(lib, directory)
print('\n\n\nComplete! Open the text file next to this app just generated. Find Output.txt')
time.sleep(5)
else:
print('\n\nClosing now. No appinfo.vdf file found.')

########last_working############## The last working code.

# list = []
# V.moveV(directory)
# time.sleep(0.5)
# # Calling the cmd4 function in the VParse.py file.

# list = V.cmd4(directory)
# gamedic = V.parser(list)
# val = V.constructor(gamedic)
# V.writer(gamedic, directory)
# V.writer(ar)
###############################################


# f'{VDFexe} {appinfo} --pretty >output.json'
#
# # A special variable in Python that gets assigned the name of the module.
if __name__ == "__main__":
main()
Loading

0 comments on commit 7f45426

Please sign in to comment.