This commit is contained in:
devdesk 2023-06-11 13:41:02 +03:00
parent 15a2e4d070
commit c36686d3a8

View File

@ -8,14 +8,16 @@ class ExportAndRunScript(inkex.EffectExtension):
def effect(self): def effect(self):
# Define the export file path # Define the export file path
png_file_path = "~/yair/exported.png" png_file_path = "/home/devdesk/yair/thermatext/labels/exported.png"
# Get the current selection # Get the current selection
selection = self.svg.selected selection = self.svg.selected
inkex.errormsg(selection)
# If there's no selection, show an error and exit # If there's no selection, show an error and exit
if not selection: if not selection:
inkex.dialogs.errormsg("No selection to export.") # inkex.dialogs.errormsg("No selection to export.")
inkex.errormsg("No selection to export.")
return return
# Export the selection to PNG # Export the selection to PNG
@ -40,7 +42,7 @@ class ExportAndRunScript(inkex.EffectExtension):
bash_script_path = "print.sh" bash_script_path = "print.sh"
# Create a command that calls the bash script with the PNG as an argument # Create a command that calls the bash script with the PNG as an argument
command = ["bash", bash_script_path, png_file_path] command = ["sudo", "brother_ql", "-b", "pyusb", "--model", "QL-570", "-p", "usb://0x04f9:0x2028/000M6Z401370", "print", "-l", "62", png_file_path]
# Run the command # Run the command
subprocess.check_call(command) subprocess.check_call(command)