Skip to content

Commit

Permalink
Updated Linux setup shell script for version 1.2rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
aecreations committed Jul 3, 2022
1 parent bf7079b commit 14c406d
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/syncClippings-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ from tkinter import filedialog
DEBUG = False
APP_NAME = "Sync Clippings"
APP_VER = "1.2b2"
APP_VER = "1.2rc1"
CONF_FILENAME = "syncClippings.ini"
SYNC_FILENAME = "clippings-sync.json"
Expand Down Expand Up @@ -189,25 +189,19 @@ def getSyncFileInfo(aSyncFileDir):
if not Path(aSyncFileDir).exists():
log("getSyncFileInfo(): Directory does not exist: %s" % aSyncFileDir)
return rv
syncFilePath = Path(aSyncFileDir) / SYNC_FILENAME
if not syncFilePath.exists():
log("getSyncFileInfo(): Sync file does not exist at directory %s" % aSyncFileDir)
return rv
fileInfo = os.stat(syncFilePath)
fileSizeBytes = fileInfo.st_size
rv["fileName"] = SYNC_FILENAME
# Convert file size to kilobytes, and show 1 decimal place if < 10 KB.
numDigits = None
fileSizeKB = int(fileSizeBytes) / 1024
if fileSizeKB < 10:
numDigits = 1
rv["fileSizeKB"] = round(fileSizeKB, numDigits)
return rv
def getSyncedClippingsData(aSyncFileDir):
Expand All @@ -216,7 +210,6 @@ def getSyncedClippingsData(aSyncFileDir):
log("getSyncedClippingsData(): Directory does not exist: %s" % aSyncFileDir)
syncDirPath = Path(aSyncFileDir)
syncDirPath.mkdir(parents=True)
log("getSyncedClippingsData(): aSyncFileDir: %s" % aSyncFileDir)
syncFilePath = Path(aSyncFileDir) / SYNC_FILENAME
if syncFilePath.exists():
Expand All @@ -231,7 +224,6 @@ def getSyncedClippingsData(aSyncFileDir):
rv = fileData
if file is not None:
file.close()
return rv
def updateSyncedClippingsData(aSyncFileDir, aSyncedClippingsData):
Expand All @@ -252,21 +244,19 @@ def promptSyncFldrPath():
rv = ""
root = tk.Tk()
root.withdraw()
root.overrideredirect(True)
root.geometry('0x0+0+0')
root.deiconify()
root.lift()
root.focus_force()
# Additional hack for macOS.
if platform.system() == "Darwin":
os.system('''/usr/bin/osascript -e 'tell app "Finder" to set frontmost of process "Python" to true' ''')
homeDir = os.path.expanduser("~")
rv = filedialog.askdirectory(initialdir=homeDir)
# On Linux, an empty tuple is returned if user cancelled from file picker.
if str(rv) == "()":
rv = ""
# Get rid of the top-level instance once to make it invisible.
root.destroy()
return rv
Expand Down

0 comments on commit 14c406d

Please sign in to comment.