Skip to content

Commit

Permalink
Added Folders Show Correctly (#12)
Browse files Browse the repository at this point in the history
* Added Folders Show Correctly

Implementation uses Symbolic Links

* Get Next Commit Number

* Get Next Commit Number Try#2

* Get Next Commit Number Try@3

* Get Next Commit Number Try@4
  • Loading branch information
rafay-pk authored Apr 8, 2023
1 parent e79f0a0 commit b42c691
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Extract Commit Number
id: extract_commit
shell: bash
run: echo "commits=$(git rev-list --count ${{ steps.extract_branch.outputs.branch }})" >>$GITHUB_OUTPUT
run: echo "commits=$(( $(git rev-list --count $(git rev-parse --abbrev-ref HEAD)) + 1))" >>$GITHUB_OUTPUT
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Development
data/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
10 changes: 9 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ def __init__(self):
self.dock_folders = QDockWidget("Folders")
self.dock_folders.setWidget(self.folders)
self.fileSystem = QFileSystemModel()
self.fileSystem.setRootPath("")
self.folder_path = os.getcwd().replace("\\", '/') + "/data/folders/"
os.makedirs(self.folder_path, exist_ok=True)
self.fileSystem.setRootPath(self.folder_path)
self.fileSystem.setFilter(QDir.Filter.Dirs | QDir.Filter.NoDotAndDotDot)
self.folders.setModel(self.fileSystem)
self.folders.setRootIndex(self.fileSystem.index(self.folder_path))
self.folders.setHeaderHidden(True)
for column in range(1, self.fileSystem.columnCount()):
self.folders.setColumnHidden(column, True)
Expand Down Expand Up @@ -143,6 +146,11 @@ def __init__(self):
def add_folder(self):
path = QFileDialog.getExistingDirectory(self,
"Select Folder to Add to View", os.path.expanduser("~"))
target = self.folder_path + os.path.basename(path)
if os.path.exists(target):
self.status.showMessage(f"Folder already exists - {path}")
return
os.symlink(path, target, target_is_directory=True)
self.status.showMessage(f"Added - {path}")

def open_file(self): # DEV
Expand Down

0 comments on commit b42c691

Please sign in to comment.