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
5489ce99
Commit
5489ce99
authored
Dec 22, 2010
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added detection of Windows console size
parent
41f9600f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
5 deletions
+31
-5
fs/commands/runner.py
+30
-4
fs/mountfs.py
+1
-1
No files found.
fs/commands/runner.py
View file @
5489ce99
...
...
@@ -10,7 +10,35 @@ import platform
from
collections
import
defaultdict
import
re
if
platform
.
system
()
==
'Linux'
:
if
platform
.
system
()
==
'Windows'
:
def
getTerminalSize
():
try
:
## {{{ http://code.activestate.com/recipes/440694/ (r3)
from
ctypes
import
windll
,
create_string_buffer
# stdin handle is -10
# stdout handle is -11
# stderr handle is -12
h
=
windll
.
kernel32
.
GetStdHandle
(
-
12
)
csbi
=
create_string_buffer
(
22
)
res
=
windll
.
kernel32
.
GetConsoleScreenBufferInfo
(
h
,
csbi
)
if
res
:
import
struct
(
bufx
,
bufy
,
curx
,
cury
,
wattr
,
left
,
top
,
right
,
bottom
,
maxx
,
maxy
)
=
struct
.
unpack
(
"hhhhHhhhhhh"
,
csbi
.
raw
)
sizex
=
right
-
left
+
1
sizey
=
bottom
-
top
+
1
else
:
sizex
,
sizey
=
80
,
25
# can't determine actual size - return default values
return
sizex
,
sizey
except
:
return
80
,
25
else
:
def
getTerminalSize
():
def
ioctl_GWINSZ
(
fd
):
try
:
...
...
@@ -34,9 +62,7 @@ if platform.system() == 'Linux' :
except
:
cr
=
(
25
,
80
)
return
int
(
cr
[
1
]),
int
(
cr
[
0
])
else
:
def
getTerminalSize
():
return
80
,
50
def
_unicode
(
text
):
if
not
isinstance
(
text
,
unicode
):
...
...
fs/mountfs.py
View file @
5489ce99
...
...
@@ -4,7 +4,7 @@ fs.mountfs
Contains MountFS class which is a virtual filesystem which can have other filesystems linked as branched directories.
For example, lets say we have two filesystems containing config files and resource respectively::
For example, lets say we have two filesystems containing config files and resource
s
respectively::
[config_fs]
|-- config.cfg
...
...
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