- Posts: 574
- Thank you received: 0
FileManager extensions
5 years 11 months ago #189875
by hottabich
Replied by hottabich on topic FileManager extensions
Hello! Editor file does not work. Linuxcnc from 11/18/20. Is it mine or a general question? Prompt
you are welcome.
you are welcome.
Please Log in to join the conversation.
5 years 11 months ago #189928
by cmorley
Replied by cmorley on topic FileManager extensions
I see this problem too. probably do to recent changes to processed_key_event__()
when I added WRITER code.
I'll look into it soon.
Chris
when I added WRITER code.
I'll look into it soon.
Chris
Please Log in to join the conversation.
5 years 11 months ago #189952
by cmorley
Replied by cmorley on topic FileManager extensions
try in handlerfile
Code:
if flag:
if isinstance(receiver2, GCODE):
# if in manual or in readonly mode do our keybindings - otherwise
# send events to gcode widget
if STATUS.is_man_mode() == False or not receiver2.editor.isReadOnly():
if is_pressed:
receiver.keyPressEvent(event)
Please Log in to join the conversation.
5 years 11 months ago #189960
by hottabich
Replied by hottabich on topic FileManager extensions
Thanks, it works! Another question before the attached file loaded well, and now the code is loading
and the picture remains the same.
and the picture remains the same.
Please Log in to join the conversation.
5 years 11 months ago #190025
by hottabich
Replied by hottabich on topic FileManager extensions
If you write in the handler like this
then when selected, all files will be loaded ngc, tap. In the interface phillc54 must be removed USB copy file.
Code:
#####################
# GENERAL FUNCTIONS #
#####################
def load_code(self, fname):
if fname is None: return
if fname.endswith(".ngc") or fname.endswith(".py") or fname.endswith(".tap"):
Please Log in to join the conversation.
5 years 11 months ago #190026
by cmorley
Replied by cmorley on topic FileManager extensions
that function has changed quite a bit recently.
It now checks for extension type in INI
In master the function looks like this:
It now checks for extension type in INI
Code:
[FILTER]
PROGRAM_EXTENSION = .ngc,.nc,.tap G-Code File (*.ngc,*.nc,*.tap)
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python
In master the function looks like this:
Code:
def load_code(self, fname):
if fname is None: return
filename, file_extension = os.path.splitext(fname)
if not fname.endswith(".html"):
if not (INFO.program_extension_valid(fname)):
self.add_status("Unknown or invalid filename extension {}".format(file_extension))
return
self.w.cmb_gcode_history.addItem(fname)
self.w.cmb_gcode_history.setCurrentIndex(self.w.cmb_gcode_history.count() - 1)
ACTION.OPEN_PROGRAM(fname)
self.add_status("Loaded program file : {}".format(fname))
self.w.main_tab_widget.setCurrentIndex(TAB_MAIN)
self.w.filemanager.recordBookKeeping()
# adjust ending to check for related setup files
fname = filename+'.html'
if os.path.exists(fname):
self.w.web_view.load(QtCore.QUrl.fromLocalFile(fname))
self.add_status("Loaded HTML file : {}".format(fname))
else:
self.w.web_view.setHtml(self.html)
return
else:
try:
self.w.web_view.load(QtCore.QUrl.fromLocalFile(fname))
self.add_status("Loaded HTML file : {}".format(fname))
self.w.main_tab_widget.setCurrentIndex(TAB_SETUP)
self.w.stackedWidget.setCurrentIndex(0)
self.w.btn_setup.setChecked(True)
self.w.jogging_frame.hide()
except Exception as e:
print("Error loading HTML file : {}".format(e))
Please Log in to join the conversation.
5 years 11 months ago #190028
by cmorley
The very first line
'Q Linuxcnc.ngc'
is not legal code
Chris
Replied by cmorley on topic FileManager extensions
hottabich wrote: Thanks, it works! Another question before the attached file loaded well, and now the code is loading
and the picture remains the same.
The very first line
'Q Linuxcnc.ngc'
is not legal code
Chris
Please Log in to join the conversation.
5 years 11 months ago #190030
by cmorley
Replied by cmorley on topic FileManager extensions
this is in the next release of 2.8
Code:
def load_code(self, fname):
if fname is None: return
filename, file_extension = os.path.splitext(fname)
if not fname.endswith(".html"):
if not (INFO.program_extension_valid(fname)):
self.add_status("Unknown or invalid filename extension {}".format(file_extension))
return
self.w.cmb_gcode_history.addItem(fname)
self.w.cmb_gcode_history.setCurrentIndex(self.w.cmb_gcode_history.count() - 1)
ACTION.OPEN_PROGRAM(fname)
self.add_status("Loaded program file : {}".format(fname))
self.w.main_tab_widget.setCurrentIndex(TAB_MAIN)
elif fname.endswith(".html"):
self.web_view.load(QtCore.QUrl.fromLocalFile(fname))
self.add_status("Loaded HTML file : {}".format(fname))
self.w.main_tab_widget.setCurrentIndex(TAB_SETUP)
self.w.btn_setup.setChecked(True)
else:
self.add_status("Unknown or invalid filename")
Please Log in to join the conversation.
5 years 11 months ago #190031
by hottabich
Replied by hottabich on topic FileManager extensions
Thanks! But it worked before. But that's not a problem. I'll put all your corrections into my interfaces. Thank you very much!cmorley wrote:
hottabich wrote: Thanks, it works! Another question before the attached file loaded well, and now the code is loading
and the picture remains the same.
The very first line
'Q Linuxcnc.ngc'
is not legal code
Chris
Please Log in to join the conversation.
Time to create page: 0.048 seconds
