Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
08428cd2
Commit
08428cd2
authored
Nov 19, 2009
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes to make browsewin work with latest wxPython
parent
95719dd2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
7 deletions
+20
-7
fs/browsewin.py
+20
-7
No files found.
fs/browsewin.py
View file @
08428cd2
...
@@ -46,10 +46,17 @@ class BrowseFrame(wx.Frame):
...
@@ -46,10 +46,17 @@ class BrowseFrame(wx.Frame):
self
.
SetTitle
(
"FS Browser - "
+
str
(
fs
))
self
.
SetTitle
(
"FS Browser - "
+
str
(
fs
))
self
.
tree
=
wx
.
gizmos
.
TreeListCtrl
(
self
,
-
1
,
style
=
wx
.
TR_DEFAULT_STYLE
|
wx
.
TR_HIDE_ROOT
)
self
.
tree
=
wx
.
gizmos
.
TreeListCtrl
(
self
,
-
1
,
style
=
wx
.
TR_DEFAULT_STYLE
|
wx
.
TR_HIDE_ROOT
)
self
.
tree
.
AddColumn
(
"File System"
,
300
)
self
.
tree
.
AddColumn
(
"Description"
,
250
)
self
.
tree
.
AddColumn
(
"File System"
)
self
.
tree
.
AddColumn
(
"Size"
,
150
)
self
.
tree
.
AddColumn
(
"Description"
)
self
.
tree
.
AddColumn
(
"Created"
,
250
)
self
.
tree
.
AddColumn
(
"Size"
)
self
.
tree
.
AddColumn
(
"Created"
)
self
.
tree
.
SetColumnWidth
(
0
,
300
)
self
.
tree
.
SetColumnWidth
(
1
,
250
)
self
.
tree
.
SetColumnWidth
(
2
,
150
)
self
.
tree
.
SetColumnWidth
(
3
,
250
)
self
.
root_id
=
self
.
tree
.
AddRoot
(
'root'
,
data
=
wx
.
TreeItemData
(
{
'path'
:
"/"
,
'expanded'
:
False
}
))
self
.
root_id
=
self
.
tree
.
AddRoot
(
'root'
,
data
=
wx
.
TreeItemData
(
{
'path'
:
"/"
,
'expanded'
:
False
}
))
rid
=
self
.
tree
.
GetItemData
(
self
.
root_id
)
rid
=
self
.
tree
.
GetItemData
(
self
.
root_id
)
...
@@ -92,8 +99,8 @@ class BrowseFrame(wx.Frame):
...
@@ -92,8 +99,8 @@ class BrowseFrame(wx.Frame):
paths
=
[(
self
.
fs
.
isdir
(
p
),
p
)
for
p
in
self
.
fs
.
listdir
(
path
,
absolute
=
True
)]
paths
=
[(
self
.
fs
.
isdir
(
p
),
p
)
for
p
in
self
.
fs
.
listdir
(
path
,
absolute
=
True
)]
if
not
paths
:
if
not
paths
:
self
.
tree
.
SetItemHasChildren
(
item_id
,
False
)
#
self.tree.SetItemHasChildren(item_id, False)
self
.
tree
.
Collapse
(
item_id
)
#
self.tree.Collapse(item_id)
return
return
paths
.
sort
(
key
=
lambda
p
:(
not
p
[
0
],
p
[
1
]
.
lower
()))
paths
.
sort
(
key
=
lambda
p
:(
not
p
[
0
],
p
[
1
]
.
lower
()))
...
@@ -153,6 +160,13 @@ class BrowseFrame(wx.Frame):
...
@@ -153,6 +160,13 @@ class BrowseFrame(wx.Frame):
def
browse
(
fs
):
def
browse
(
fs
):
"""Displays a window containing a tree control that displays an FS
object. Double-click a file/folder to display extra info.
fs -- A filesystem object
"""
app
=
wx
.
PySimpleApp
()
app
=
wx
.
PySimpleApp
()
frame
=
BrowseFrame
(
fs
)
frame
=
BrowseFrame
(
fs
)
frame
.
Show
()
frame
.
Show
()
...
@@ -163,4 +177,3 @@ if __name__ == "__main__":
...
@@ -163,4 +177,3 @@ if __name__ == "__main__":
from
osfs
import
OSFS
from
osfs
import
OSFS
home_fs
=
OSFS
(
"~/"
)
home_fs
=
OSFS
(
"~/"
)
browse
(
home_fs
)
browse
(
home_fs
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment