|
@@ -204,7 +204,7 @@ def resolve_path(path):
|
204
|
204
|
#get line and column numbers
|
205
|
205
|
line_num = 1
|
206
|
206
|
column_num = 1
|
207
|
|
- line_start = path.find(':')
|
|
207
|
+ line_start = path.find(':', 2) # use 2 here so don't eat Windows full path
|
208
|
208
|
column_start = path.find(':', line_start + 1)
|
209
|
209
|
if column_start == -1:
|
210
|
210
|
column_start = len(path)
|
|
@@ -218,57 +218,69 @@ def resolve_path(path):
|
218
|
218
|
if not(column_start == column_end):
|
219
|
219
|
column_num = path[ column_start + 1 : column_end]
|
220
|
220
|
if column_num == '':
|
221
|
|
- column_num = 1
|
|
221
|
+ column_num = 0
|
222
|
222
|
|
|
223
|
+ index_end = path.find(',')
|
|
224
|
+ if 0 <= index_end:
|
|
225
|
+ path = path[ : index_end] # delete comma and anything after
|
|
226
|
+ index_end = path.find(':', 2)
|
|
227
|
+ if 0 <= index_end:
|
|
228
|
+ path = path[ : path.find(':', 2)] # delete the line number and anything after
|
223
|
229
|
|
224
|
|
- path = path[ : path.find(':')] # delete the line number and anything after
|
225
|
230
|
path = path.replace('\\','/')
|
226
|
231
|
|
227
|
|
- # resolve as many '../' as we can
|
228
|
|
- while 0 <= path.find('../'):
|
229
|
|
- end = path.find('../') - 1
|
230
|
|
- start = path.find('/')
|
231
|
|
- while 0 <= path.find('/',start) and end > path.find('/',start):
|
232
|
|
- start = path.find('/',start) + 1
|
233
|
|
- path = path[0:start] + path[end + 4: ]
|
234
|
|
-
|
235
|
|
- # this is an alternative to the above - it just deletes the '../' section
|
236
|
|
- # start_temp = path.find('../')
|
237
|
|
- # while 0 <= path.find('../',start_temp):
|
238
|
|
- # start = path.find('../',start_temp)
|
239
|
|
- # start_temp = start + 1
|
240
|
|
- # if 0 <= start:
|
241
|
|
- # path = path[start + 2 : ]
|
242
|
|
-
|
243
|
|
-
|
244
|
|
- start = path.find('/')
|
245
|
|
- if not(0 == start): # make sure path starts with '/'
|
246
|
|
- while 0 == path.find(' '): # eat any spaces at the beginning
|
247
|
|
- path = path[ 1 : ]
|
248
|
|
- path = '/' + path
|
|
232
|
+ if 1 == path.find(':') and current_OS == 'Windows':
|
|
233
|
+ return path, line_num, column_num # found a full path - no need for further processing
|
|
234
|
+ elif 0 == path.find('/') and (current_OS == 'Linux' or current_OS == 'Darwin'):
|
|
235
|
+ return path, line_num, column_num # found a full path - no need for further processing
|
249
|
236
|
|
250
|
|
- if current_OS == 'Windows':
|
251
|
|
- search_path = path.replace('/', '\\') # os.walk uses '\' in Windows
|
252
|
237
|
else:
|
253
|
|
- search_path = path
|
254
|
|
-
|
255
|
|
- start_path = os.path.abspath('')
|
256
|
238
|
|
257
|
|
- # search project directory for the selection
|
258
|
|
- found = False
|
259
|
|
- full_path = ''
|
260
|
|
- for root, directories, filenames in os.walk(start_path):
|
261
|
|
- for filename in filenames:
|
262
|
|
- if 0 <= root.find('.git'): # don't bother looking in this directory
|
263
|
|
- break
|
264
|
|
- full_path = os.path.join(root,filename)
|
265
|
|
- if 0 <= full_path.find(search_path):
|
266
|
|
- found = True
|
267
|
|
- break
|
268
|
|
- if found:
|
269
|
|
- break
|
|
239
|
+ # resolve as many '../' as we can
|
|
240
|
+ while 0 <= path.find('../'):
|
|
241
|
+ end = path.find('../') - 1
|
|
242
|
+ start = path.find('/')
|
|
243
|
+ while 0 <= path.find('/',start) and end > path.find('/',start):
|
|
244
|
+ start = path.find('/',start) + 1
|
|
245
|
+ path = path[0:start] + path[end + 4: ]
|
|
246
|
+
|
|
247
|
+ # this is an alternative to the above - it just deletes the '../' section
|
|
248
|
+ # start_temp = path.find('../')
|
|
249
|
+ # while 0 <= path.find('../',start_temp):
|
|
250
|
+ # start = path.find('../',start_temp)
|
|
251
|
+ # start_temp = start + 1
|
|
252
|
+ # if 0 <= start:
|
|
253
|
+ # path = path[start + 2 : ]
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+ start = path.find('/')
|
|
257
|
+ if not(0 == start): # make sure path starts with '/'
|
|
258
|
+ while 0 == path.find(' '): # eat any spaces at the beginning
|
|
259
|
+ path = path[ 1 : ]
|
|
260
|
+ path = '/' + path
|
|
261
|
+
|
|
262
|
+ if current_OS == 'Windows':
|
|
263
|
+ search_path = path.replace('/', '\\') # os.walk uses '\' in Windows
|
|
264
|
+ else:
|
|
265
|
+ search_path = path
|
|
266
|
+
|
|
267
|
+ start_path = os.path.abspath('')
|
|
268
|
+
|
|
269
|
+ # search project directory for the selection
|
|
270
|
+ found = False
|
|
271
|
+ full_path = ''
|
|
272
|
+ for root, directories, filenames in os.walk(start_path):
|
|
273
|
+ for filename in filenames:
|
|
274
|
+ if 0 <= root.find('.git'): # don't bother looking in this directory
|
|
275
|
+ break
|
|
276
|
+ full_path = os.path.join(root,filename)
|
|
277
|
+ if 0 <= full_path.find(search_path):
|
|
278
|
+ found = True
|
|
279
|
+ break
|
|
280
|
+ if found:
|
|
281
|
+ break
|
270
|
282
|
|
271
|
|
- return full_path, line_num, column_num
|
|
283
|
+ return full_path, line_num, column_num
|
272
|
284
|
|
273
|
285
|
# end - resolve_path
|
274
|
286
|
|
|
@@ -324,6 +336,9 @@ def open_file(path):
|
324
|
336
|
elif current_OS == 'Linux':
|
325
|
337
|
|
326
|
338
|
command = file_path + ':' + str(line_num) + ':' + str(column_num)
|
|
339
|
+ index_end = command.find(',')
|
|
340
|
+ if 0 <= index_end:
|
|
341
|
+ command = command[ : index_end] # sometimes a comma magically appears, don't want it
|
327
|
342
|
running_apps = subprocess.Popen('ps ax -o cmd', stdout=subprocess.PIPE, shell=True)
|
328
|
343
|
(output, err) = running_apps.communicate()
|
329
|
344
|
temp = output.split('\n')
|
|
@@ -336,7 +351,7 @@ def open_file(path):
|
336
|
351
|
return False , ''
|
337
|
352
|
|
338
|
353
|
(success_sublime, editor_path_sublime) = find_editor_linux('sublime_text',temp)
|
339
|
|
- (success_atom, editor_path_atom) = find_editor+linux('atom',temp)
|
|
354
|
+ (success_atom, editor_path_atom) = find_editor_linux('atom',temp)
|
340
|
355
|
|
341
|
356
|
if success_sublime:
|
342
|
357
|
subprocess.Popen([editor_path_sublime, command])
|
|
@@ -350,6 +365,9 @@ def open_file(path):
|
350
|
365
|
elif current_OS == 'Darwin': # MAC
|
351
|
366
|
|
352
|
367
|
command = file_path + ':' + str(line_num) + ':' + str(column_num)
|
|
368
|
+ index_end = command.find(',')
|
|
369
|
+ if 0 <= index_end:
|
|
370
|
+ command = command[ : index_end] # sometimes a comma magically appears, don't want it
|
353
|
371
|
running_apps = subprocess.Popen('ps axwww -o command', stdout=subprocess.PIPE, shell=True)
|
354
|
372
|
(output, err) = running_apps.communicate()
|
355
|
373
|
temp = output.split('\n')
|
|
@@ -424,8 +442,11 @@ def get_build_last():
|
424
|
442
|
date_last = 0.0
|
425
|
443
|
DIR__pioenvs = os.listdir('.pioenvs')
|
426
|
444
|
for name in DIR__pioenvs:
|
|
445
|
+ if 0 <= name.find('.') or 0 <= name.find('-'): # skip files in listing
|
|
446
|
+ continue
|
427
|
447
|
DIR_temp = os.listdir('.pioenvs/' + name)
|
428
|
448
|
for names_temp in DIR_temp:
|
|
449
|
+
|
429
|
450
|
if 0 == names_temp.find('firmware.'):
|
430
|
451
|
date_temp = os.path.getmtime('.pioenvs/' + name + '/' + names_temp)
|
431
|
452
|
if date_temp > date_last:
|
|
@@ -941,7 +962,7 @@ class output_window(Text):
|
941
|
962
|
Text.__init__(self, self.frame, borderwidth=3, relief="sunken")
|
942
|
963
|
self.config(tabs=(400,)) # configure Text widget tab stops
|
943
|
964
|
self.config(background = 'black', foreground = 'white', font= ("consolas", 12), wrap = 'word', undo = 'True')
|
944
|
|
- self.config(height = 24, width = 120)
|
|
965
|
+ self.config(height = 24, width = 100)
|
945
|
966
|
self.config(insertbackground = 'pale green') # keyboard insertion point
|
946
|
967
|
self.pack(side='left', fill='both', expand=True)
|
947
|
968
|
|