Removed TABs
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18755 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -11,11 +11,11 @@
|
||||
import time
|
||||
|
||||
Month = {2: 'February', 3: 'March', None: 0, 'July': 7, 11:
|
||||
'November', 'December': 12, 'June': 6, 'January': 1, 'September': 9,
|
||||
'August': 8, 'March': 3, 'November': 11, 'April': 4, 12: 'December',
|
||||
'May': 5, 10: 'October', 9: 'September', 8: 'August', 7: 'July', 6:
|
||||
'June', 5: 'May', 4: 'April', 'October': 10, 'February': 2, 1:
|
||||
'January', 0: None}
|
||||
'November', 'December': 12, 'June': 6, 'January': 1, 'September': 9,
|
||||
'August': 8, 'March': 3, 'November': 11, 'April': 4, 12: 'December',
|
||||
'May': 5, 10: 'October', 9: 'September', 8: 'August', 7: 'July', 6:
|
||||
'June', 5: 'May', 4: 'April', 'October': 10, 'February': 2, 1:
|
||||
'January', 0: None}
|
||||
|
||||
# Number of days per month (except for February in leap years)
|
||||
mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
|
||||
|
@@ -126,8 +126,8 @@ class wxGridSizer(wxPySizer):
|
||||
|
||||
sz = self.GetSize()
|
||||
pt = self.GetPosition()
|
||||
w = (sz.width - (ncols - 1) * self.hgap) / ncols;
|
||||
h = (sz.height - (nrows - 1) * self.vgap) / nrows;
|
||||
w = (sz.width - (ncols - 1) * self.hgap) / ncols;
|
||||
h = (sz.height - (nrows - 1) * self.vgap) / nrows;
|
||||
|
||||
x = pt.x
|
||||
for c in range(ncols):
|
||||
|
@@ -14,7 +14,7 @@
|
||||
# View "All Image" File Types as default filter
|
||||
# Sort the file list
|
||||
# Use newer "re" function for patterns
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
import os, sys, string
|
||||
@@ -30,7 +30,7 @@ def ConvertBMP(file_nm):
|
||||
fl_fld = os.path.splitext(file_nm)
|
||||
ext = fl_fld[1]
|
||||
ext = string.lower(ext[1:])
|
||||
if ext == 'bmp':
|
||||
if ext == 'bmp':
|
||||
image = wxImage(file_nm, wxBITMAP_TYPE_BMP)
|
||||
elif ext == 'gif':
|
||||
image = wxImage(file_nm, wxBITMAP_TYPE_GIF)
|
||||
@@ -93,31 +93,31 @@ class ImageView(wxWindow):
|
||||
|
||||
def DrawImage(self, dc):
|
||||
try:
|
||||
image = self.image
|
||||
image = self.image
|
||||
except:
|
||||
return
|
||||
|
||||
self.DrawBorder(dc)
|
||||
if image is None:
|
||||
return
|
||||
|
||||
|
||||
bmp = image.ConvertToBitmap()
|
||||
|
||||
|
||||
iwidth = bmp.GetWidth() # dimensions of image file
|
||||
iheight = bmp.GetHeight()
|
||||
|
||||
|
||||
diffx = (self.image_sizex - iwidth)/2 # center calc
|
||||
if iwidth >= self.image_sizex -10: # if image width fits in window adjust
|
||||
diffx = 5
|
||||
iwidth = self.image_sizex - 10
|
||||
|
||||
|
||||
diffy = (self.image_sizey - iheight)/2 # center calc
|
||||
if iheight >= self.image_sizey - 10: # if image height fits in window adjust
|
||||
diffy = 5
|
||||
iheight = self.image_sizey - 10
|
||||
|
||||
image.Rescale(iwidth, iheight) # rescale to fit the window
|
||||
image.ConvertToBitmap()
|
||||
image.ConvertToBitmap()
|
||||
bmp = image.ConvertToBitmap()
|
||||
dc.DrawBitmap(bmp, diffx, diffy) # draw the image to window
|
||||
|
||||
@@ -125,38 +125,38 @@ class ImageView(wxWindow):
|
||||
class ImageDialog(wxDialog):
|
||||
def __init__(self, parent, set_dir = None):
|
||||
wxDialog.__init__(self, parent, -1, "Image Browser", wxPyDefaultPosition, wxSize(400, 400))
|
||||
|
||||
|
||||
self.x_pos = 30 # initial display positions
|
||||
self.y_pos = 20
|
||||
self.delta = 20
|
||||
self.delta = 20
|
||||
|
||||
size = wxSize(80, 25)
|
||||
|
||||
|
||||
self.set_dir = os.getcwd()
|
||||
|
||||
|
||||
if set_dir != None:
|
||||
if os.path.exists(set_dir): # set to working directory if nothing set
|
||||
self.set_dir = set_dir
|
||||
|
||||
|
||||
self.dir_x = self.x_pos
|
||||
self.dir_y = self.y_pos
|
||||
self.DisplayDir() # display the directory value
|
||||
|
||||
|
||||
self.y_pos = self.y_pos + self.delta
|
||||
|
||||
mID = NewId()
|
||||
wxButton(self, mID, ' Set Directory ', wxPoint(self.x_pos, self.y_pos), size).SetDefault()
|
||||
EVT_BUTTON(self, mID, self.SetDirect)
|
||||
|
||||
self.type_posy = self.y_pos # save the y position for the image type combo
|
||||
self.type_posy = self.y_pos # save the y position for the image type combo
|
||||
|
||||
self.fl_ext = '*.bmp' # initial setting for file filtering
|
||||
self.GetFiles() # get the file list
|
||||
|
||||
|
||||
self.y_pos = self.y_pos + self.delta + 10
|
||||
|
||||
self.list_height = 150
|
||||
|
||||
|
||||
# List of Labels
|
||||
mID = NewId()
|
||||
self.tb = tb = wxListBox(self, mID, wxPoint(self.x_pos, self.y_pos), wxSize(160, self.list_height), self.fl_list, wxLB_SINGLE)
|
||||
@@ -170,12 +170,12 @@ class ImageDialog(wxDialog):
|
||||
image_sizey = self.list_height
|
||||
|
||||
self.fl_types = ["All Images", "Bmp", "Gif", "Png", "Jpg", "Ico", "Pnm", "Pcx", "Tif", "All Files"]
|
||||
self.fl_ext_types = { "All Images": "All", "Bmp": "*.bmp", "Gif": "*.gif", "Png": "*.png", "Jpg": "*.jpg",
|
||||
self.fl_ext_types = { "All Images": "All", "Bmp": "*.bmp", "Gif": "*.gif", "Png": "*.png", "Jpg": "*.jpg",
|
||||
"Ico": "*.ico", "Pnm": "*.pnm", "Pcx": "*.pcx", "Tif": "*.tif", "All Files": "*.*" }
|
||||
|
||||
|
||||
self.set_type = self.fl_types[0] # initial file filter setting
|
||||
self.fl_ext = self.fl_ext_types[self.set_type]
|
||||
|
||||
|
||||
mID = NewId()
|
||||
self.sel_type = wxComboBox(self, mID, self.set_type, wxPoint(image_posx , self.type_posy), wxSize(150, -1), self.fl_types, wxCB_DROPDOWN)
|
||||
EVT_COMBOBOX(self, mID, self.OnSetType)
|
||||
@@ -193,7 +193,7 @@ class ImageDialog(wxDialog):
|
||||
self.y_pos = self.y_pos + self.delta
|
||||
fsize = wxSize(400, self.y_pos + 50) # resize dialog for final vertical position
|
||||
self.SetSize(fsize)
|
||||
|
||||
|
||||
self.ResetFiles()
|
||||
|
||||
def GetFiles(self): # get the file list using directory and extension values
|
||||
@@ -204,7 +204,7 @@ class ImageDialog(wxDialog):
|
||||
self.fl_val = FindFiles(self, self.set_dir, filter)
|
||||
all_files = all_files + self.fl_val.files # add to list of files
|
||||
self.fl_list = all_files
|
||||
else:
|
||||
else:
|
||||
self.fl_val = FindFiles(self, self.set_dir, self.fl_ext)
|
||||
self.fl_list = self.fl_val.files
|
||||
|
||||
@@ -212,19 +212,19 @@ class ImageDialog(wxDialog):
|
||||
|
||||
def DisplayDir(self): # display the working directory
|
||||
wxStaticText(self, -1, self.set_dir, wxPoint(self.dir_x, self.dir_y), wxSize(250, -1))
|
||||
|
||||
|
||||
def OnSetType(self, event):
|
||||
val = event.GetString() # get file type value
|
||||
self.fl_ext = self.fl_ext_types[val]
|
||||
self.ResetFiles()
|
||||
|
||||
self.ResetFiles()
|
||||
|
||||
def OnListDClick(self, event):
|
||||
self.OnOk(0)
|
||||
|
||||
|
||||
def OnListClick(self, event):
|
||||
val = event.GetSelection()
|
||||
self.SetListValue(val)
|
||||
|
||||
|
||||
def SetListValue(self, val):
|
||||
file_nm = self.fl_list[val]
|
||||
self.set_file = file_val = os.path.join(self.set_dir, file_nm)
|
||||
@@ -237,7 +237,7 @@ class ImageDialog(wxDialog):
|
||||
self.set_dir = dlg.GetPath()
|
||||
self.ResetFiles()
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
def ResetFiles(self): # refresh the display with files and initial image
|
||||
self.DisplayDir()
|
||||
self.GetFiles()
|
||||
@@ -247,13 +247,13 @@ class ImageDialog(wxDialog):
|
||||
self.SetListValue(0)
|
||||
except:
|
||||
self.image_view.SetValue(None)
|
||||
|
||||
|
||||
def GetFile(self):
|
||||
return self.set_file
|
||||
|
||||
def GetDirectory(self):
|
||||
return self.set_dir
|
||||
|
||||
|
||||
def OnCancel(self, event):
|
||||
self.result = None
|
||||
self.EndModal(wxID_CANCEL)
|
||||
@@ -282,7 +282,7 @@ class FindFiles:
|
||||
pattern = self.MakeRegex(mask)
|
||||
for i in os.listdir(dir):
|
||||
if i == "." or i == "..":
|
||||
continue
|
||||
continue
|
||||
path = os.path.join(dir, i)
|
||||
path = string.upper(path)
|
||||
value = string.upper(i)
|
||||
@@ -290,11 +290,11 @@ class FindFiles:
|
||||
if pattern.match(value) != None:
|
||||
filelist.append(i)
|
||||
|
||||
self.files = filelist
|
||||
self.files = filelist
|
||||
|
||||
def MakeRegex(self, pattern):
|
||||
import re
|
||||
f = "" # Set up a regex for file names
|
||||
f = "" # Set up a regex for file names
|
||||
for ch in pattern:
|
||||
if ch == "*":
|
||||
f = f + ".*"
|
||||
|
@@ -101,7 +101,7 @@ class PrintBase:
|
||||
|
||||
cnt = 0
|
||||
for word in split:
|
||||
bword = " " + word # blank + word
|
||||
bword = " " + word # blank + word
|
||||
length = len(bword)
|
||||
|
||||
w, h = self.DC.GetTextExtent(text + bword)
|
||||
|
@@ -248,7 +248,7 @@ class PyShellWindow(wxStyledTextCtrl, InteractiveInterpreter):
|
||||
def OnUpdateUI(self, evt):
|
||||
# check for matching braces
|
||||
braceAtCaret = -1
|
||||
braceOpposite = -1
|
||||
braceOpposite = -1
|
||||
charBefore = None
|
||||
caretPos = self.GetCurrentPos()
|
||||
if caretPos > 0:
|
||||
|
@@ -136,7 +136,7 @@ class wxVTKRenderWindowBase(wxWindow):
|
||||
|
||||
|
||||
def OnCreateWindow(self, event):
|
||||
hdl = self.GetHandle()
|
||||
hdl = self.GetHandle()
|
||||
try:
|
||||
self._RenderWindow.SetParentInfo(str(hdl))
|
||||
except:
|
||||
@@ -163,7 +163,7 @@ class wxVTKRenderWindowBase(wxWindow):
|
||||
# Windows.
|
||||
#self._RenderWindow.GetSize()
|
||||
#
|
||||
self._RenderWindow.SetSize(sz.width, sz.height)
|
||||
self._RenderWindow.SetSize(sz.width, sz.height)
|
||||
|
||||
|
||||
def OnLeftButtonDown(self, event):
|
||||
|
@@ -241,27 +241,27 @@ def _my_import(name):
|
||||
def _param2dict(param):
|
||||
i = 0; j = 0; s = len(param); d = {}
|
||||
while 1:
|
||||
while i<s and param[i] == " " : i = i+1
|
||||
if i>=s: break
|
||||
j = i
|
||||
while j<s and param[j] != "=": j=j+1
|
||||
if j+1>=s:
|
||||
break
|
||||
word = param[i:j]
|
||||
i=j+1
|
||||
if (param[i] == '"'):
|
||||
j=i+1
|
||||
while j<s and param[j] != '"' : j=j+1
|
||||
if j == s: break
|
||||
val = param[i+1:j]
|
||||
elif (param[i] != " "):
|
||||
j=i+1
|
||||
while j<s and param[j] != " " : j=j+1
|
||||
val = param[i:j]
|
||||
else:
|
||||
val = ""
|
||||
i=j+1
|
||||
d[word] = val
|
||||
while i<s and param[i] == " " : i = i+1
|
||||
if i>=s: break
|
||||
j = i
|
||||
while j<s and param[j] != "=": j=j+1
|
||||
if j+1>=s:
|
||||
break
|
||||
word = param[i:j]
|
||||
i=j+1
|
||||
if (param[i] == '"'):
|
||||
j=i+1
|
||||
while j<s and param[j] != '"' : j=j+1
|
||||
if j == s: break
|
||||
val = param[i+1:j]
|
||||
elif (param[i] != " "):
|
||||
j=i+1
|
||||
while j<s and param[j] != " " : j=j+1
|
||||
val = param[i:j]
|
||||
else:
|
||||
val = ""
|
||||
i=j+1
|
||||
d[word] = val
|
||||
return d
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user