Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nautilus: Fix Python3 and remove many debug #373

Merged
merged 1 commit into from
Jun 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions shell_integration/nautilus/syncstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self):
self._listeners = [self._update_registered_paths, self._get_version]
self._remainder = ''.encode()
self.protocolVersion = '1.0'
self.nautilusVFSFile_table = {} # not needed in this object actually but shared
self.nautilusVFSFile_table = {} # not needed in this object actually but shared
# all over the other objects.

# returns true when one should try again!
Expand Down Expand Up @@ -96,19 +96,16 @@ def _connectToSocketServer(self):
self._sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock_file = os.path.join(get_runtime_dir(), appname, "socket")
try:
print("Socket File: " + sock_file)
self._sock.connect(sock_file) # fails if sock_file doesn't exist
self.connected = True
print("Setting connected to %r." % self.connected )
self._watch_id = GObject.io_add_watch(self._sock, GObject.IO_IN, self._handle_notify)
print("Socket watch id: " + str(self._watch_id))

self.sendCommand('VERSION:\n')
self.sendCommand('GET_STRINGS:\n')

return False # Don't run again
except Exception as e:
print("Could not connect to unix socket. " + str(e))
print("Could not connect to unix socket " + sock_file + ". " + str(e))
except Exception as e: # Bad habbit
print("Connect could not be established, try again later.")
self._sock.close()
Expand All @@ -131,7 +128,7 @@ def read_socket_data_with_timeout(self, timeout):

# Parses response lines out of collected data, returns list of strings
def get_available_responses(self):
end = self._remainder.rfind('\n'.encode())
end = self._remainder.rfind(b'\n')
if end == -1:
return []
data = self._remainder[:end]
Expand All @@ -152,7 +149,7 @@ def _handle_notify(self, source, condition):
return True # Run again

def handle_server_response(self, line):
print("Server response: " + line)
# print("Server response: " + line)
parts = line.split(':')
action = parts[0]
args = parts[1:]
Expand Down Expand Up @@ -342,7 +339,7 @@ def legacy_menu_items(self, files):


def context_menu_action(self, menu, action, filename):
print("Context menu: " + action + ' ' + filename)
# print("Context menu: " + action + ' ' + filename)
socketConnect.sendCommand(action + ":" + filename + "\n")


Expand Down