コード例 #1
0
    def __install_button_cb(self, button, data):
        if self.conf.check_policy('warning-download-update'):
            device_dialer = tgcm.core.FreeDesktop.DeviceDialer()
            device_manager = tgcm.core.FreeDesktop.DeviceManager()
            device = device_manager.get_main_device()
            if device_dialer.is_modem() and device.is_connected():
                tech_mm = device.get_access_technology()
                if tech_mm in (ACCESS_TECH_GSM, ACCESS_TECH_GSM_COMPACT, \
                        ACCESS_TECH_GPRS, ACCESS_TECH_EDGE):
                    markup = _("<b>Warning: slow connection</b>")
                    message = _(
                        "Your connection seems too slow and the download would take you quite a long time. Are you sure to continue?"
                    )

                    resp = question_dialog(message,
                                           markup=markup,
                                           parent=self.dialog)
                    if resp == gtk.RESPONSE_NO:
                        return

        self.progress_dialog = tgcm.ui.MSD.MSDProgressWindow(
            parent=self.dialog)
        self.progress_dialog.set_show_buttons(False)
        message = _("Please wait a minute...")
        self.progress_dialog.show(message, message)

        entry = self.__get_selected_row(self.updates_treeview)
        self.news_service.install_async(entry['id'],
                                        self.__on_install_callback)
        if gtk.events_pending():
            gtk.main_iteration(False)
コード例 #2
0
    def __install_button_cb(self, button, data):
        if self.conf.check_policy('warning-download-update'):
            device_dialer = tgcm.core.FreeDesktop.DeviceDialer()
            device_manager = tgcm.core.FreeDesktop.DeviceManager()
            device = device_manager.get_main_device()
            if device_dialer.is_modem() and device.is_connected():
                tech_mm = device.get_access_technology()
                if tech_mm in (ACCESS_TECH_GSM, ACCESS_TECH_GSM_COMPACT, \
                        ACCESS_TECH_GPRS, ACCESS_TECH_EDGE):
                    markup = _("<b>Warning: slow connection</b>")
                    message = _("Your connection seems too slow and the download would take you quite a long time. Are you sure to continue?")

                    resp = question_dialog(message, markup=markup, parent=self.dialog)
                    if resp == gtk.RESPONSE_NO:
                        return

        self.progress_dialog = tgcm.ui.MSD.MSDProgressWindow(parent=self.dialog)
        self.progress_dialog.set_show_buttons(False)
        message = _("Please wait a minute...")
        self.progress_dialog.show(message, message)

        entry = self.__get_selected_row(self.updates_treeview)
        self.news_service.install_async(entry['id'], self.__on_install_callback)
        if gtk.events_pending():
            gtk.main_iteration(False)
コード例 #3
0
ファイル: AddressBook.py プロジェクト: calabozo/tgcmlinux
    def on_remove_button_clicked(self, widget, event=None):
        contacts = self.__selected_contacts()
        length = len (contacts)
        if length == 0:
            return
        elif length == 1:
            message = _(u'Do you want to delete the contact "%s"?') % (contacts[0].name)
            wait_msg = _('Please wait until the contact is deleted.')
        else:
            message = _(u'Do you want to delete the %d selected contacts?') % length
            wait_msg = _('Please wait until the contacts are deleted.')

        response = question_dialog(message, parent = self.dialog, icon = 'addressbook_taskbar.png')
        if response != gtk.RESPONSE_YES:
            return

        dlg = wait_dialog(wait_msg, parent = self.dialog, threaded = True)
        gobject.idle_add(self.__remove_contacts, contacts, dlg)
        dlg.run()