🔥 Deactivating namedpipe stuff
This is not yet working and we'll concentrate on TCP and maybe UDS for now.
This commit is contained in:
1 parent
e0d874059d
commit
7f8cc5601b
3 files changed
+53
-44
No files matched your search
@@ -37,13 +37,14 @@ def register_transports(settings):
|
||||
# Not available on this platform
|
||||
pass
|
||||
|
||||
try:
|
||||
from .namedpipetransport import NamedPipeTransport
|
||||
|
||||
register_transport(NamedPipeTransport, settings, SETTINGS_PATH)
|
||||
except ImportError:
|
||||
# Not available on this platform
|
||||
pass
|
||||
# Commented out for now since this is far from working
|
||||
# try:
|
||||
# from .namedpipetransport import NamedPipeTransport
|
||||
#
|
||||
# register_transport(NamedPipeTransport, settings, SETTINGS_PATH)
|
||||
# except ImportError:
|
||||
# # Not available on this platform
|
||||
# pass
|
||||
|
||||
# more transports provided by plugins
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2021 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
"""
|
||||
This is currently not included in OctoPrint's available transports since it still contains some horrible
|
||||
bugs.
|
||||
|
||||
Further testing and development is needed.
|
||||
"""
|
||||
|
||||
from os import scandir
|
||||
|
||||
from flask_babel import gettext
|
||||
|
||||
@@ -268,43 +268,44 @@ class VirtualPrinterPlugin(
|
||||
|
||||
##~~ Win32 Named Pipe
|
||||
|
||||
try:
|
||||
from win32 import win32file, win32pipe
|
||||
|
||||
class PipeVirtualPrinterWrapper(VirtualPrinterWrapper):
|
||||
def __init__(self, pipe, *args, **kwargs):
|
||||
self._pipe = pipe
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def _do_read(self, size):
|
||||
result, data = win32file.ReadFile(self._pipe, size, None)
|
||||
return data
|
||||
|
||||
def _do_write(self, data):
|
||||
win32file.WriteFile(self._pipe, data)
|
||||
|
||||
@click.command("win32pipe")
|
||||
@click.option("--name", "name", default="OctoPrint-VirtualPrinter")
|
||||
def win32pipe_command(name):
|
||||
click.echo(f"Creating named pipe {name}...")
|
||||
p = win32pipe.CreateNamedPipe(
|
||||
r"\\.\pipe\\" + name,
|
||||
win32pipe.PIPE_ACCESS_DUPLEX,
|
||||
win32pipe.PIPE_TYPE_MESSAGE | win32pipe.PIPE_WAIT,
|
||||
1,
|
||||
65536,
|
||||
65536,
|
||||
300,
|
||||
None,
|
||||
)
|
||||
win32pipe.ConnectNamedPipe(p, None)
|
||||
virtual = PipeVirtualPrinterWrapper(p, settings, datafolder)
|
||||
virtual.wait()
|
||||
|
||||
commands.append(win32pipe_command)
|
||||
except ImportError:
|
||||
# not supported on this platform
|
||||
pass
|
||||
# Commented out for now since this is far from working
|
||||
# try:
|
||||
# from win32 import win32file, win32pipe
|
||||
#
|
||||
# class PipeVirtualPrinterWrapper(VirtualPrinterWrapper):
|
||||
# def __init__(self, pipe, *args, **kwargs):
|
||||
# self._pipe = pipe
|
||||
# super().__init__(*args, **kwargs)
|
||||
#
|
||||
# def _do_read(self, size):
|
||||
# result, data = win32file.ReadFile(self._pipe, size, None)
|
||||
# return data
|
||||
#
|
||||
# def _do_write(self, data):
|
||||
# win32file.WriteFile(self._pipe, data)
|
||||
#
|
||||
# @click.command("win32pipe")
|
||||
# @click.option("--name", "name", default="OctoPrint-VirtualPrinter")
|
||||
# def win32pipe_command(name):
|
||||
# click.echo(f"Creating named pipe {name}...")
|
||||
# p = win32pipe.CreateNamedPipe(
|
||||
# r"\\.\pipe\\" + name,
|
||||
# win32pipe.PIPE_ACCESS_DUPLEX,
|
||||
# win32pipe.PIPE_TYPE_MESSAGE | win32pipe.PIPE_WAIT,
|
||||
# 1,
|
||||
# 65536,
|
||||
# 65536,
|
||||
# 300,
|
||||
# None,
|
||||
# )
|
||||
# win32pipe.ConnectNamedPipe(p, None)
|
||||
# virtual = PipeVirtualPrinterWrapper(p, settings, datafolder)
|
||||
# virtual.wait()
|
||||
#
|
||||
# commands.append(win32pipe_command)
|
||||
# except ImportError:
|
||||
# # not supported on this platform
|
||||
# pass
|
||||
|
||||
# return collected commands
|
||||
return commands
|
||||
|
||||
Reference in new issue
Block a user