Skip to content

Commit

Permalink
version 0.9.5, added messages, changed README, fix sorting for files …
Browse files Browse the repository at this point in the history
…and folders in a treeview
  • Loading branch information
qiray committed Jan 31, 2018
1 parent f8a244a commit 15c080a
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 4 deletions.
90 changes: 90 additions & 0 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
[
{
"caption": "Preferences",
"mnemonic": "n",
"id": "preferences",
"children":
[
{
"caption": "Package Settings",
"mnemonic": "P",
"id": "package-settings",
"children":
[
{
"caption": "Opened Files",
"children":
[
{
"command": "open_file",
"args": {"file": "${packages}/OpenedFiles/opened_files.sublime-settings"},
"caption": "Settings – Default"
},
{
"command": "open_file",
"args": {"file": "${packages}/User/opened_files.sublime-settings"},
"caption": "Settings – User"
},
{ "caption": "-" },
{
"command": "open_file",
"args": {"file": "${packages}/OpenedFiles/Default.sublime-keymap"},
"caption": "Key Bindings – Default (Common)"
},
{
"command": "open_file",
"args": {
"file": "${packages}/OpenedFiles/Default (OSX).sublime-keymap",
"platform": "OSX"
},
"caption": "Key Bindings – Default (OSX)"
},
{
"command": "open_file",
"args": {
"file": "${packages}/OpenedFiles/Default (Linux).sublime-keymap",
"platform": "Linux"
},
"caption": "Key Bindings – Default (Linux)"
},
{
"command": "open_file",
"args": {
"file": "${packages}/OpenedFiles/Default (Windows).sublime-keymap",
"platform": "Windows"
},
"caption": "Key Bindings – Default (Windows)"
},

{
"command": "open_file",
"args": {
"file": "${packages}/User/Default (OSX).sublime-keymap",
"platform": "OSX"
},
"caption": "Key Bindings – User"
},
{
"command": "open_file",
"args": {
"file": "${packages}/User/Default (Linux).sublime-keymap",
"platform": "Linux"
},
"caption": "Key Bindings – User"
},
{
"command": "open_file",
"args": {
"file": "${packages}/User/Default (Windows).sublime-keymap",
"platform": "Windows"
},
"caption": "Key Bindings – User"
},
{ "caption": "-" }
]
}
]
}
]
}
]
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ It has different settings and also can be shown on right or left side:

## Installation

You can install this plugin by cloning this repo into your SublimeText Packages directory and rename it to `OpenedFiles`.
You can install this plugin via [Sublime Package Control](https://packagecontrol.io/)

Or by cloning this repo into your SublimeText Packages directory and rename it to `OpenedFiles`.

## Settings

Expand Down
3 changes: 1 addition & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@

VERSION_MAJOR = 0
VERSION_MINOR = 9
VERSION_PATCH = 4
VERSION_PATCH = 5

ST3 = int(sublime.version()) >= 3000

#TODO: add comments
#TODO: write README file

if ST3:
from .common import untitled_name, debug, SYNTAX_EXTENSION
Expand Down
4 changes: 4 additions & 0 deletions messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"install": "messages/install.txt",
"0.9.5": "messages/0.9.5.txt"
}
7 changes: 7 additions & 0 deletions messages/0.9.5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
0.9.5

README file changed (added PackageControl URL in installation paragraph).

Added settings menu.

Fixed sort for files and dirs. Now folders are always ahead of files in treeview.
5 changes: 5 additions & 0 deletions messages/install.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Thank you for installing OpenedFiles - plugin to show opened files as a treeview or a listview

For more information please read:

https://github.com/qiray/SublimeOpenedFiles
2 changes: 1 addition & 1 deletion show.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# This file uses functions from Sublime FileBrowser plugin with MIT license - https://packagecontrol.io/packages/FileBrowser

import os
import sublime
from os.path import basename
import sublime

ST3 = int(sublime.version()) >= 3000

Expand Down
3 changes: 3 additions & 0 deletions treeview.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def print_children(self, array, actions_map, length, stringnum):
if self.status == 'unfold':
return result, stringnum
children = sorted(self.children)
children.sort(key=lambda x: array[x].status == 'file')
for child in children:
temp, stringnum = array[child].print_children(array, actions_map, length + 1, stringnum)
result += temp
Expand Down Expand Up @@ -93,6 +94,7 @@ def __str__(self):
result = ''
self.actions_map.clear()
printed_parents = sorted(self.parents) #dict here becomes list!
printed_parents.sort(key=lambda x: self.nodes[x].status == 'file')
plugin_settings = sublime.load_settings('opened_files.sublime-settings')
Tree.tree_size = plugin_settings.get('tree_size')
if Tree.tree_size != 'default' and Tree.tree_size != 'full' and Tree.tree_size != 'medium':
Expand All @@ -101,6 +103,7 @@ def __str__(self):
while len(printed_parents) == 1:
key = printed_parents[0]
templist = sorted(self.nodes[key].children)
templist.sort(key=lambda x: self.nodes[x].status == 'file')
flag = False
for filename in templist:
if self.nodes[filename].status == 'file':
Expand Down

0 comments on commit 15c080a

Please sign in to comment.