-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapv.py
More file actions
39 lines (32 loc) · 1021 Bytes
/
Copy pathmapv.py
File metadata and controls
39 lines (32 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# mapv.py - map viewer
import os
import wx
from ui import DlgFrame
#-------------------------------------------------------------------------------
# I want stdout to be unbuffered, always
#-------------------------------------------------------------------------------
class Unbuffered(object):
def __init__(self, stream):
self.stream = stream
def write(self, data):
self.stream.write(data)
self.stream.flush()
def __getattr__(self, attr):
return getattr(self.stream, attr)
import sys
sys.stdout = Unbuffered(sys.stdout)
#===============================================================================
# main
#===============================================================================
if __name__ == '__main__':
arg = None
if len(sys.argv) == 2:
arg = sys.argv[1]
app = wx.App()
if arg is None:
DlgFrame()
elif os.path.isfile(arg):
DlgFrame(filepath=arg)
else:
DlgFrame(mapname=arg)
app.MainLoop()