Skip to content

Commit

Permalink
Bug fix #78 Error when opening a shell console on Linux / Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
Bing committed Jun 1, 2023
1 parent 5ec5e0a commit 7c7dbc7
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 14 deletions.
10 changes: 5 additions & 5 deletions Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,11 @@ def Test(self, event):
print("Entrering Test function (used during development only) ...")
# device = get_phone()
# res = device.open_shell()
start_time = time.time()
self.update_widget_states()
end_time = time.time()
elapsed_time = end_time - start_time
print(f"The function update_widget_states took {elapsed_time} seconds to execute.")
# start_time = time.time()
# self.update_widget_states()
# end_time = time.time()
# elapsed_time = end_time - start_time
# print(f"The function update_widget_states took {elapsed_time} seconds to execute.")

# -----------------------------------------------
# _on_help_about
Expand Down
2 changes: 1 addition & 1 deletion build-on-mac.spec
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ exe = EXE(pyz,
icon='images/icon-256.icns')
app = BUNDLE(exe,
name='PixelFlasher.app',
version='5.2.0.0',
version='5.2.0.1',
icon='./images/icon-256.icns',
bundle_identifier='com.badabing.pixelflasher')
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
rm -rf build dist
VERSION=5.2.0.0
VERSION=5.2.0.1
NAME="PixelFlasher"
DIST_NAME="PixelFlasher"

Expand Down
2 changes: 1 addition & 1 deletion constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

APPNAME = 'PixelFlasher'
CONFIG_FILE_NAME = 'PixelFlasher.json'
VERSION = '5.2.0.0'
VERSION = '5.2.0.1'
SDKVERSION = '33.0.3'
WIDTH = 1400
HEIGHT = 1040
Expand Down
11 changes: 10 additions & 1 deletion phone.py
Original file line number Diff line number Diff line change
Expand Up @@ -1987,7 +1987,16 @@ def open_shell(self):
puml(":Opening an adb shell command;\n", True)
theCmd = f"\"{get_adb()}\" -s {self.id} shell"
debug(theCmd)
subprocess.Popen(theCmd, creationflags=subprocess.CREATE_NEW_CONSOLE, env=get_env_variables())
if sys.platform.startswith("win"):
subprocess.Popen(theCmd, creationflags=subprocess.CREATE_NEW_CONSOLE, env=get_env_variables())
elif sys.platform.startswith("linux"):
subprocess.Popen([get_linux_shell(), "--", "/bin/bash", "-c", theCmd])
elif sys.platform.startswith("darwin"):
script_file = tempfile.NamedTemporaryFile(delete=False, suffix='.sh')
script_file.write(f'#!/bin/bash\n{theCmd}'.encode('utf-8'))
script_file.close()
os.chmod(script_file.name, 0o755)
subprocess.Popen(['osascript', '-e', f'tell application "Terminal" to do script "{script_file.name}"'], env=get_env_variables())
return 0
else:
print(f"\n{datetime.now():%Y-%m-%d %H:%M:%S} ERROR: The Device {self.id} is not in adb mode.")
Expand Down
2 changes: 1 addition & 1 deletion windows-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# https://github.com/DudeNr33/pyinstaller-versionfile
# create-version-file windows-metadata.yaml --outfile windows-version-info.txt
Version: 5.2.0.0
Version: 5.2.0.1
FileDescription: PixelFlasher
InternalName: PixelFlasher
OriginalFilename: PixelFlasher.exe
Expand Down
8 changes: 4 additions & 4 deletions windows-version-info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ VSVersionInfo(
ffi=FixedFileInfo(
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
# Set not needed items to zero 0. Must always contain 4 elements.
filevers=(5,2,0,0),
prodvers=(5,2,0,0),
filevers=(5,2,0,1),
prodvers=(5,2,0,1),
# Contains a bitmask that specifies the valid bits 'flags'r
mask=0x3f,
# Contains a bitmask that specifies the Boolean attributes of the file.
Expand All @@ -32,12 +32,12 @@ VSVersionInfo(
u'040904B0',
[StringStruct(u'CompanyName', u''),
StringStruct(u'FileDescription', u'PixelFlasher'),
StringStruct(u'FileVersion', u'5.2.0.0'),
StringStruct(u'FileVersion', u'5.2.0.1'),
StringStruct(u'InternalName', u'PixelFlasher'),
StringStruct(u'LegalCopyright', u''),
StringStruct(u'OriginalFilename', u'PixelFlasher.exe'),
StringStruct(u'ProductName', u'PixelFlasher'),
StringStruct(u'ProductVersion', u'5.2.0.0')])
StringStruct(u'ProductVersion', u'5.2.0.1')])
]),
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
]
Expand Down

0 comments on commit 7c7dbc7

Please sign in to comment.