Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.3.4 - fix for broken onVisibilityChanged in non epic gametypes since WoT 1.10.0.2 #3

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
9664560
v0.33
fusi0n Jul 11, 2020
57968a8
Update README.md
CH4MPi Jul 13, 2020
6214ae7
v0.3.4
fusi0n Sep 18, 2020
55adb75
Merge remote-tracking branch 'origin/master'
fusi0n Sep 18, 2020
a43fbab
v0.3.4
fusi0n Sep 18, 2020
6c7fd92
v0.3.5b1
fusi0n Oct 15, 2020
113c6a2
v0.3.5b1
fusi0n Oct 15, 2020
886a18a
v0.3.5b1
fusi0n Oct 15, 2020
eb83dc5
v0.3.6 for WoT 1.10.1
fusi0n Oct 17, 2020
f258dd8
v0.3.6 for WoT 1.10.1
fusi0n Oct 21, 2020
96dd5c1
Delete __init__.pyc
CH4MPi Oct 21, 2020
cbfa1a5
Delete utils.pyc
CH4MPi Oct 21, 2020
086b5d9
Delete flash.pyc
CH4MPi Oct 21, 2020
7385247
v0.3.7 for WoT 1.10.1
fusi0n Nov 16, 2020
14b8826
v0.3.7 for WoT 1.10.1
fusi0n Nov 16, 2020
3235e34
v0.3.8 for WoT 1.13.0.0 and higher
fusi0n Jul 10, 2021
2a44df8
0.3.9: added ability to work with lobby view
PolyacovYury Sep 20, 2021
79ffecd
v0.3.9 for WoT client v1.14.0.3 and higher
fusi0n Sep 20, 2021
8fbdd8b
v0.4.0 for WoT client v1.14.1.3 and higher
fusi0n Nov 4, 2021
f8b91be
v0.4.1 for WoT client v1.14.1.3 and higher
fusi0n Nov 4, 2021
d763afe
v0.4.1 for WoT client v1.14.1.3 and higher
fusi0n Nov 4, 2021
f34c2ea
Update swc.md
CH4MPi Nov 7, 2021
710303d
0.4.1.1: fix position animation issues once and for all
PolyacovYury Nov 3, 2021
cc896d5
Update build.json
CH4MPi Nov 16, 2021
a436dff
v0.4.2 for WoT client v1.14.1.3 and higher
fusi0n Nov 16, 2021
d5b0869
v0.4.3 for WoT client v1.17 and higher
fusi0n May 12, 2022
ee43278
v0.4.4 for WoT client v1.17 and higher
fusi0n May 28, 2022
764c466
fix(guiflash): handle textfield autosize properly
Jun 5, 2022
e8de43a
chore(guiflash): add gitignore
Jun 5, 2022
4ab3cb2
chore(guiflash): add textfield autosize constants to python exports
Jun 5, 2022
4f6c116
fix(guiflash): don't show grab cursor when drag is disabled
Jun 5, 2022
f85e0f9
fix(guiflash): this will break border and tooltip if drag is disabled…
Jun 5, 2022
c61b355
release(guiflash): 0.4.5
Jun 5, 2022
9d30173
v0.4.6 for WoT client v1.17 and higher
fusi0n Jun 6, 2022
24d6c95
v0.4.6 for WoT client v1.17 and higher
fusi0n Jun 6, 2022
e041d04
Update README.md
CH4MPi Jun 14, 2022
1fddb50
Update README.md
CH4MPi Jun 14, 2022
f10147b
Update README.md
CH4MPi Jun 14, 2022
629ff3c
Update README.md
CH4MPi Jun 14, 2022
4df9a62
Update README.md
CH4MPi Jun 14, 2022
bd1da15
Update README.md
CH4MPi Jun 14, 2022
ed884ca
Update README.md
CH4MPi Jun 14, 2022
69aaa42
Update README.md
CH4MPi Jun 14, 2022
b65b271
v0.5.1 for WoT client v1.18 and higher
fusi0n Sep 9, 2022
7b66ec4
v0.5.2 for WoT client v1.18 and higher
fusi0n Oct 11, 2022
c3ec945
v0.5.2 for WoT client v1.18 and higher
fusi0n Oct 11, 2022
ab3a5be
v0.6.0 for WoT client v1.18 and higher
fusi0n Nov 14, 2022
f28797f
v0.6.1
fusi0n Apr 7, 2024
3492c57
v0.6.2
fusi0n May 2, 2024
425934a
v0.6.3
fusi0n Sep 10, 2024
07a9e15
v0.6.4
fusi0n Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# no idea files at all
.idea/

# we don't want compiled flash files here
*.swc
*.swf

# we even don't want new flash folders
/res/gui/flash/as3proj/obj
/res/gui/flash/as3proj/swc

# we also don't want compiled wotmod files
*.wotmod

# and for sure no compiled python files
*.pyc

# and we also say no to log-files
*.log

# we also no longer wan't the build folder
/build/
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Some notes for contribution to this project:

If you want to contribute to the project you should discuss things with the project maintainer before you request a pull request.

Feel free to create a new topic here on the forum and let's discuss things and what do you want to change/enhance and why it's needed.

## Version numbering
The version numbering of the project follows the following format:

xx.yy.zz

xx - major version<br>
yy - minor version<br>
zz - build<br>

Version numbering is done by the project maintainer and should never be done by the project contributor itself. Please keep this in mind if you want to create a pull request.


## wotmod-file
Never try to merge the .wotmod-file into the repo. This will also be created by the project maintainer after your pull request was accepted or a new update was released. You can find the current release version here: [**Releases**](https://github.com/CH4MPi/GUIFlash/releases)

## a personal note
Help is always welcome. If you sent in a pull request, please wait if it will be accepted. You shouldn't release your changes to the community before the pull-request was accepted to avoid that there is more than one GUIFlash version outside.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017-2019 GambitER
Copyright (c) 2017-2019 GambitER, 2020 CH4MPi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

## .. GUIFlash ..

_Позволяет динамически создавать компоненты для отображения текстовой и графической информации в Flash интерфейсе игры World of Tanks. Создание и управление компонентами производится через Python скрипты (модификации клиента)._
Copyright: (c) 2017-2019 GambitER, since 2020 CH4MPi

This project is maintained by CH4MPi

## English
Allows you to dynamically create components for displaying text and graphic information in the Flash interface of the game World of Tanks. Components are created and managed using Python scripts (client modifications).

Learn more @ [**Wiki**](https://github.com/CH4MPi/GUIFlash/wiki).

## Russian
Позволяет динамически создавать компоненты для отображения текстовой и графической информации в Flash интерфейсе игры World of Tanks. Создание и управление компонентами производится через Python скрипты (модификации клиента)._

Подробнее в [**Wiki**](https://github.com/GambitER/GUIFlash/wiki).


![https://img.shields.io/badge/Status-WIP-orange](https://img.shields.io/badge/Status-WIP-orange) ![https://img.shields.io/badge/Realese-Yes-green](https://img.shields.io/badge/Realese-Yes-green) ![https://img.shields.io/badge/Python-2.7-blue](https://img.shields.io/badge/Python-2.7-blue)
18 changes: 18 additions & 0 deletions build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": 1,
"software": {
"animate": "C:\\Program Files\\Adobe\\Adobe Animate 2020\\Animate.exe",
"python": "C:\\Program Files\\Python\\python.exe"
},
"game": {
"folder": "X:\\wot\\ct",
"version": "1.26.0.0"
},
"info": {
"id": "guiflash",
"author": "gambiter",
"name": "GUIFlash",
"description": "Flash components for use in python mods.",
"version": "0.6.4"
}
}
275 changes: 275 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
import datetime
import json
import os
import shutil
import subprocess
import sys
import time
import zipfile


def copytree(source, destination, ignore=None):
"""implementation of shutil.copytree
original sometimes throw error on folders create"""
for item in os.listdir(source):
# skip git files
if '.gitkeep' in item:
continue
sourcePath = os.path.join(source, item)
destinationPath = os.path.join(destination, item)
# use copytree for directory
if not os.path.isfile(sourcePath):
copytree(sourcePath, destinationPath, ignore)
continue
# make dir by os module
dirName, fileName = os.path.split(destinationPath)
if not os.path.isdir(dirName):
os.makedirs(dirName)
# skip files by ignore pattern
if ignore:
ignored_names = ignore(source, os.listdir(source))
if fileName in ignored_names:
continue
# copy file
shutil.copy2(sourcePath, destinationPath)


def zipFolder(source, destination, mode='w', compression=zipfile.ZIP_STORED):
""" ZipFile by default don't create folders info in result zip """

def dirInfo(path):
"""return fixed ZipInfo for directory"""
info = zipfile.ZipInfo(path, now)
info.filename = info.filename[seek_offset:]
if not info.filename:
return None
if not info.filename.endswith('/'):
info.filename += '/'
info.compress_type = compression
return info

def fileInfo(path):
"""return fixed ZipInfo for file"""
info = zipfile.ZipInfo(path, now)
info.external_attr = 33206 << 16 # -rw-rw-rw-
info.filename = info.filename[seek_offset:]
info.compress_type = compression
return info

with zipfile.ZipFile(destination, mode, compression) as zipfh:
now = tuple(datetime.datetime.now().timetuple())[:6]
seek_offset = len(source) + 1
for dirName, _, files in os.walk(source):
info = dirInfo(dirName)
if info:
zipfh.writestr(info, '')
for fileName in files:
filePath = os.path.join(dirName, fileName)
info = fileInfo(filePath)
zipfh.writestr(info, open(filePath, 'rb').read())


def processRunning(path):
"""Cheek is process running, no"""
processName = os.path.basename(path).lower()
try:
import psutil
for proc in psutil.process_iter():
if proc.name().lower() == processName:
return True
return False
except ImportError:
if os.name == 'nt':
for task in (x.split() for x in subprocess.check_output('tasklist').splitlines()):
if task and task[0].lower() == processName:
return True
return False
else:
print('cant list process on your system')
print('run -> pip install psutil')
raise NotImplementedError


def buildFlash():
if not BUILD_FLASH:
return

# working directory URI for Animate
flashWD = os.getcwd().replace('\\', '/').replace(':', '|')

# JSFL file with commands for Animate
jsflFile = 'build.jsfl'
jsflContent = ''

files = set()

# add publishDocument command for all *.fla and *.xfl files
for dirPath, _, fileNames in os.walk('as3'):
for fileName in fileNames:
if fileName.endswith('.fla') or fileName.endswith('.xfl'):
dirPath = dirPath.replace('\\', '/')
logName = fileName.replace('.fla', '.log').replace('.xfl', '.log')
files.add((dirPath, fileName, logName))

if not files:
return

for dirPath, fileName, logName in files:
documentURI = 'file:///{}/{}/{}'.format(flashWD, dirPath, fileName)
logFileURI = 'file:///{}/{}'.format(flashWD, logName)
jsflContent += 'fl.publishDocument("{}", "Default");\n'.format(documentURI)
jsflContent += 'fl.compilerErrors.save("{}", false, true);\n'.format(logFileURI)
jsflContent += '\n'

# add close command only if Animate not opened
if not processRunning(CONFIG.software.animate):
jsflContent += 'fl.quit(false);'

# save commands for Animate
with open(jsflFile, 'w') as fh:
fh.write(jsflContent)

# run Animate
try:
subprocess.call([CONFIG.software.animate, '-e', jsflFile, '-AlwaysRunJSFL'], stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
print (e)

# publishing can be asynchronous when Animate is already opened
# so waiting script file unlock to remove, which means publishing is done
while os.path.exists(jsflFile):
try:
os.remove(jsflFile)
except: # NOSONAR
time.sleep(.1)

for dirPath, fileName, logName in files:
log_data = ''
if os.path.isfile(logName):
data = open(logName, 'r').read().splitlines()
if len(data) > 1:
log_data = '\n'.join(data[:-2])
os.remove(logName)

if log_data:
print ('Failed publish: {}/{}'.format(dirPath, fileName))
print (log_data)
else:
print ('Published: {}/{}'.format(dirPath, fileName))


def buildPython():
for dirPath, _, fileNames in os.walk('res/scripts'):
for fileName in fileNames:
if not fileName.endswith('.py'):
continue
filePath = "{}/{}".format(dirPath, fileName).replace('\\', '/')
try:
subprocess.check_output([CONFIG['software']['python'], '-m', 'py_compile', filePath],
stderr=subprocess.STDOUT).decode()
print ('Compiled: {}'.format(filePath))
except subprocess.CalledProcessError as e:
print ('\nFailed compile: {}'.format(filePath))
output = e.output.decode()
print (output)


# handle args from command line
BUILD_FLASH = 'flash' in sys.argv
COPY_INTO_GAME = 'ingame' in sys.argv
CREATE_DISTRIBUTE = 'distribute' in sys.argv

# load config
assert os.path.isfile('build.json'), 'Config not found'
with open('build.json', 'r') as fh:
CONFIG = json.loads(fh.read())

GAME_FOLDER = CONFIG['game']['folder']
GAME_VERSION = CONFIG['game']['version']

# cheek in-game folder
WOT_PACKAGES_DIR = '{wot}/mods/{version}/'.format(wot=GAME_FOLDER, version=GAME_VERSION)
if COPY_INTO_GAME:
assert os.path.isdir(WOT_PACKAGES_DIR), 'WoT mods folder not found'

# package data
PACKAGE_NAME = '{author}.{name}_{version}.wotmod'.format(author=CONFIG['info']['author'],
name=CONFIG['info']['id'], version=CONFIG['info']['version'])

# generate package meta file
META = """<root>
<!-- Technical MOD ID -->
<id>{author}.{id}</id>
<!-- Package version -->
<version>{version}</version>
<!-- Human readable name -->
<name>{name}</name>
<!-- Human readable description -->
<description>{description}</description>
</root>""".format(author=CONFIG['info']['author'], id=CONFIG['info']['id'], name=CONFIG['info']['name'],
description=CONFIG['info']['description'], version=CONFIG['info']['version'])

# prepare folders
if os.path.isdir('temp'):
shutil.rmtree('temp')
os.makedirs('temp')
if os.path.isdir('build'):
shutil.rmtree('build')
os.makedirs('build')

# build flash
buildFlash()

# build python
buildPython()

# copy all staff
if os.path.isdir('resources/in'):
copytree('resources/in', 'temp/res')
if os.path.isfile('LICENSE'):
shutil.copy2('LICENSE', 'temp')
if os.path.isfile('README.md'):
shutil.copy2('README.md', 'temp')
if os.path.isfile('res/gui/flash/GUIFlash.swf'):
os.makedirs('temp/res/gui/flash')
shutil.copy2('res/gui/flash/GUIFlash.swf', 'temp/res/gui/flash')
copytree('res/scripts', 'temp/res/scripts', ignore=shutil.ignore_patterns('*.py'))
with open('temp/meta.xml', 'w') as fh:
fh.write(META)

# create package
zipFolder('temp', 'build/{}'.format(PACKAGE_NAME))

# copy package into game
if COPY_INTO_GAME:
shutil.copy2('build/{}'.format(PACKAGE_NAME), WOT_PACKAGES_DIR)

# create distribution
if CREATE_DISTRIBUTE:
os.makedirs('temp/distribute/mods/{}'.format(GAME_VERSION))
shutil.copy2('build/{}'.format(PACKAGE_NAME), 'temp/distribute/mods/{}'.format(GAME_VERSION))
if os.path.isdir('resources/out'):
copytree('resources/out', 'temp/distribute')
zipFolder('temp/distribute', 'build/{name}_{version}_{wotversion}.zip'.format(name=CONFIG['info']['id'], version=CONFIG['info']['version'], wotversion=GAME_VERSION), compression=zipfile.ZIP_DEFLATED)
# list for cleaning
cleanup_list = set([])

# builder temporary
cleanup_list.add('temp')

# Animate unnecessary
cleanup_list.add('EvalScript error.tmp')
cleanup_list.add('as3/DataStore')

# python bytecode
for dirName, _, files in os.walk('res'):
for fileName in files:
if fileName.endswith('.pyc'):
cleanup_list.add(os.path.join(dirName, fileName))

# delete files
for path in cleanup_list:
if os.path.isdir(path):
shutil.rmtree(path)
elif os.path.isfile(path):
os.remove(path)
Binary file removed gambiter.guiflash_0.3.1.wotmod
Binary file not shown.
6 changes: 0 additions & 6 deletions meta.xml

This file was deleted.

Binary file modified res/gui/flash/GUIFlash.swf
Binary file not shown.
Loading