64
gtk.Menu.popup(self, *args)
65
Gtk.Menu.popup(self, *args)
67
68
self.Signals.DisconnectAll()
70
def each(child, data):
74
self.foreach(each, None)
75
76
def set_op(self, device, message):
76
ManagerDeviceMenu.__ops__[device.GetObjectPath()] = message
77
ManagerDeviceMenu.__ops__[device.get_object_path()] = message
77
78
for inst in ManagerDeviceMenu.__instances__:
78
79
dprint("op: regenerating instance", inst)
79
80
if inst.SelectedDevice == self.SelectedDevice and not (inst.is_popup and not inst.props.visible):
83
84
def get_op(self, device):
85
return ManagerDeviceMenu.__ops__[device.GetObjectPath()]
86
return ManagerDeviceMenu.__ops__[device.get_object_path()]
89
90
def unset_op(self, device):
90
del ManagerDeviceMenu.__ops__[device.GetObjectPath()]
91
del ManagerDeviceMenu.__ops__[device.get_object_path()]
91
92
for inst in ManagerDeviceMenu.__instances__:
92
93
dprint("op: regenerating instance", inst)
93
94
if inst.SelectedDevice == self.SelectedDevice and not (inst.is_popup and not inst.props.visible):
102
def on_connect(self, item, device, service_id, *args):
103
def on_connect(self, item, device, service_id=None, *args):
103
104
def success(*args2):
105
106
uuid16 = sdp_get_serial_type(device.Address, args[0])
145
appl.SetTimeHint(gtk.get_current_event_time())
137
appl.SetTimeHint(Gtk.get_current_event_time())
149
if service_id == "network":
151
appl.ServiceProxy(svc.GetInterfaceName(),
155
reply_handler=success,
156
error_handler=fail, timeout=200)
157
#prog.set_cancellable(True)
158
#prog.connect("cancelled", cancel)
160
elif service_id == "input":
161
appl.ServiceProxy(svc.GetInterfaceName(),
164
reply_handler=success,
165
error_handler=fail, timeout=200)
166
#prog.connect("cancelled", cancel)
168
elif service_id == "serial":
171
appl.RfcommConnect(device.GetObjectPath(),
173
reply_handler=success,
174
error_handler=fail, timeout=200)
142
svc = device.Services[service_id]
144
if service_id == "network":
146
appl.ServiceProxy(svc.get_interface_name(),
147
svc.get_object_path(),
150
reply_handler=success,
151
error_handler=fail, timeout=200)
153
elif service_id == "input":
154
appl.ServiceProxy(svc.get_interface_name(),
155
svc.get_object_path(),
157
reply_handler=success,
158
error_handler=fail, timeout=200)
160
elif service_id == "serial":
163
appl.RfcommConnect(device.get_object_path(),
165
reply_handler=success,
166
error_handler=fail, timeout=200)
169
appl.ServiceProxy(svc.get_interface_name(),
170
svc.get_object_path(),
172
reply_handler=success,
173
error_handler=fail, timeout=200)
177
appl.ServiceProxy(svc.GetInterfaceName(),
180
reply_handler=success,
181
error_handler=fail, timeout=200)
175
appl.ServiceProxy(device.get_interface_name(), device.get_object_path(), 'Connect', [],
176
reply_handler=success, error_handler=fail, timeout=200)
185
def on_disconnect(self, item, device, service_id, *args):
186
svc = device.Services[service_id]
180
def on_disconnect(self, item, device, service_id=None, *args):
187
181
if service_id == "serial":
189
183
appl = AppletService()
191
185
dprint("** Failed to connect to applet")
193
appl.RfcommDisconnect(device.GetObjectPath(), args[0])
187
appl.RfcommDisconnect(device.get_object_path(), args[0])
199
193
dprint("** Failed to connect to applet")
201
appl.ServiceProxy(svc.GetInterfaceName(),
202
svc.GetObjectPath(), "Disconnect", [])
196
connection_object = device.Services[service_id]
198
connection_object = device
199
appl.ServiceProxy(connection_object.get_interface_name(),
200
connection_object.get_object_path(), "Disconnect", [])
205
203
def on_device_property_changed(self, List, device, iter, (key, value)):
222
220
if not self.is_popup or self.props.visible:
223
device = self.Blueman.List.get(self.Blueman.List.selected(), "device")["device"]
221
selected = self.Blueman.List.selected()
224
device = self.Blueman.List.get(selected, "device")["device"]
225
226
(x, y) = self.Blueman.List.get_pointer()
226
227
path = self.Blueman.List.get_path_at_pos(x, y)
228
device = self.Blueman.List.get(path[0][0], "device")["device"]
229
device = self.Blueman.List.get(path[0], "device")["device"]
390
391
item.props.tooltip_text = _("Run the setup assistant for this device")
392
def update_services(item):
394
self.unset_op(device)
395
prog.message(_("Success!"))
399
self.unset_op(device)
400
prog.message(_("Fail"))
401
MessageArea.show_message(e_(str(args[0])))
403
prog = ManagerProgressbar(self.Blueman, False, _("Refreshing"))
405
self.set_op(device, _("Refreshing Services..."))
406
appl.RefreshServices(device.GetObjectPath(), reply_handler=reply, error_handler=error)
408
item = create_menuitem(_("Refresh Services"), get_icon("gtk-refresh", 16))
410
self.Signals.Handle(item, "activate", update_services)
413
item = gtk.SeparatorMenuItem()
393
if BlueZInterface.get_interface_version()[0] < 5:
394
def update_services(item):
396
self.unset_op(device)
397
prog.message(_("Success!"))
401
self.unset_op(device)
402
prog.message(_("Fail"))
403
MessageArea.show_message(e_(str(args[0])))
405
prog = ManagerProgressbar(self.Blueman, False, _("Refreshing"))
407
self.set_op(device, _("Refreshing Services..."))
408
appl.RefreshServices(device.get_object_path(), reply_handler=reply, error_handler=error)
410
item = create_menuitem(_("Refresh Services"), get_icon("gtk-refresh", 16))
412
self.Signals.Handle(item, "activate", update_services)
415
item = Gtk.SeparatorMenuItem()
415
417
self.append(item)