Added worklist of folders
This commit is contained in:
Binary file not shown.
BIN
__pycache__/h2inc_gui.cpython-35.pyc
Normal file
BIN
__pycache__/h2inc_gui.cpython-35.pyc
Normal file
Binary file not shown.
Binary file not shown.
20
h2inc.py
20
h2inc.py
@@ -10,6 +10,10 @@ import sys
|
||||
from h2inc_parser import parseline, parseparsed
|
||||
import h2inc_gui
|
||||
|
||||
tupline = []
|
||||
preproc = ()
|
||||
outfile = ''
|
||||
folders = []
|
||||
cnt = 0
|
||||
|
||||
def sourcedir_filecnt(sourcedir):
|
||||
@@ -24,6 +28,7 @@ def sourcedir_filecnt(sourcedir):
|
||||
def sourcedir_foldercnt(sourcedir):
|
||||
### Return the number of folders, if it contains '*.h' files, in sourcedir - including subdirectories ###
|
||||
global cnt
|
||||
global folders
|
||||
for folderName, subfolders, files in os.walk(sourcedir):
|
||||
if subfolders:
|
||||
for subfolder in subfolders:
|
||||
@@ -32,4 +37,17 @@ def sourcedir_foldercnt(sourcedir):
|
||||
if tempf:
|
||||
cnt = cnt+1
|
||||
print(folderName)
|
||||
return cnt
|
||||
folders += [folderName]
|
||||
print(folders)
|
||||
return cnt
|
||||
|
||||
def process_files(sourcedir, destdir):
|
||||
WorkPath = os.path.dirname(sourcedir)
|
||||
print(WorkPath)
|
||||
incpath = destdir
|
||||
print(incpath)
|
||||
if not os.path.exists(incpath):
|
||||
os.makedirs(incpath)
|
||||
pattern = '.h'
|
||||
inputfile = 'gtkaboutdialog.h'
|
||||
filehandle = open(WorkPath+'/'+inputfile, 'r')
|
@@ -80,7 +80,7 @@ class h2incGUI:
|
||||
self.infofiles.grid(row=1, column=0, sticky=W, padx=5, pady=5)
|
||||
self.infofiles.config(state=DISABLED)
|
||||
|
||||
self.translate_button = Button(self.transframe, text="Translate!", command= lambda: self.translate(self.destdir, self.addinc))
|
||||
self.translate_button = Button(self.transframe, text="Translate!", command= lambda: self.translate(self.destdir, self.sourcedir, self.addinc))
|
||||
self.translate_button.grid(row=3, column=0, sticky=W, padx=5, pady=5)
|
||||
self.translate_button.config(state=DISABLED)
|
||||
|
||||
@@ -133,7 +133,7 @@ class h2incGUI:
|
||||
self.cfilelabel.config(state=NORMAL)
|
||||
self.totallabel.config(state=NORMAL)
|
||||
|
||||
def translate(self, destdir, addinc):
|
||||
def translate(self, destdir, sourcedir, addinc):
|
||||
doinc = addinc.get()
|
||||
dest = destdir.get()
|
||||
if doinc == 'yes':
|
||||
|
@@ -11,7 +11,7 @@ import string
|
||||
#Creates a list of elements per line in file,
|
||||
#then adding this list as a single element in a global tuple
|
||||
def parseline(lines):
|
||||
tupline = [];
|
||||
tupline = []
|
||||
word = [w for w in lines.split()]
|
||||
for w in word:
|
||||
if w in hdr_keywords:
|
||||
@@ -22,7 +22,7 @@ def parseline(lines):
|
||||
|
||||
def parseparsed(tup):
|
||||
global multilinecomment
|
||||
parsedline = '';
|
||||
parsedline = ''
|
||||
if len(tup)>0:
|
||||
if tup[0] == ELEMENT_TYPE_COMMENT_START:
|
||||
if tup[-1] == ELEMENT_TYPE_COMMENT_END:
|
||||
|
Reference in New Issue
Block a user