2 Project: BlueHi: A plugin for Canola
5 Description: This software was developed in Zagaia Project
8 Antonio R. de C. Junior <brankinhu@gmail.com>
9 Henry Miller M. Bilby <henrymiller.engenheiro@gmail.com>
10 Mauricio Figueiredo <mauricio.figueiredo@fucapi.br>
11 Samuel de Oliveira Fagundes <sf.oliveira@gmail.com>
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 You should have received a copy of the GNU General Public License along
24 with this program; if not, write to the Free Software Foundation, Inc.,
25 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 from terra.core.manager import Manager
28 from model import FileFolder, BrowseByFolder
31 WaitNotifyController = manager.get_class("Model/WaitNotify")
32 YesNoDialogModel = manager.get_class("Model/YesNoDialog")
33 BaseListController = manager.get_class("Controller/Folder")
34 BaseRowRenderer = manager.get_class("Widget/RowRenderer")
35 ResizableRowRenderer = manager.get_class("Widget/ResizableRowRenderer")
37 """Manager list devices"""
38 class DeviceListController(BaseListController):
40 This class is controller for class MainFolder, BluetoothDeviceFolder
41 and BluetoothListDevice.
43 terra_type = "Controller/Folder/Task/Apps/Bluetooth"
45 def __init__(self, model, canvas, parent):
46 BaseListController.__init__(self, model, canvas, parent)
47 self.model.callback_notify = self._show_notify
49 def _show_notify(self, err):
50 """Popup a modal with a notify message."""
51 self.parent.show_notify(err)
53 def cb_on_clicked(self,view, index):
54 model=self.model.children[index]
55 BaseListController.cb_on_clicked(self, view, index)
57 class DiretorioListController(BaseListController):
58 terra_type = "Controller/Folder/Task/Apps/Bluetooth/Choice"
60 def __init__(self, model, canvas, parent):
61 BaseListController.__init__(self, model, canvas, parent)
63 self.model.callback_notify = self._show_notify
65 def _show_notify(self, err):
66 """Popup a modal with a notify message."""
67 self.parent.show_notify(err)
69 def _show_notify_conf(self, msg):
70 def confirme(dialog, ok):
74 self.parent.show_notify(YesNoDialogModel("%s" % msg, confirme))
78 self.model.send(self.vmodel.name)
79 self.parent.show_notify(WaitNotifyController("Sending file...", 5, wait))
81 def cb_on_clicked(self, view, index):
82 self.vmodel=self.model.children[index]
84 if type(self.vmodel) is FileFolder:
85 self._show_notify_conf("Do you want to send this file?\n%s"\
89 if type(self.vmodel) is BrowseByFolder:
90 BaseListController.cb_on_clicked(self, view, index)