当前位置: 首页>>代码示例>>Python>>正文


Python kano_dialog.KanoDialog类代码示例

本文整理汇总了Python中kano.gtk3.kano_dialog.KanoDialog的典型用法代码示例。如果您正苦于以下问题:Python KanoDialog类的具体用法?Python KanoDialog怎么用?Python KanoDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了KanoDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: close_window

        def close_window(self, button, event):
            if common.need_reboot:
                kdialog = KanoDialog(
                    _("Reboot?"),
                    _("Your Kano needs to reboot for changes to apply"),
                    [
                        {
                            'label': _("LATER"),
                            'color': 'grey',
                            'return_value': False
                        },
                        {
                            'label': _("REBOOT NOW"),
                            'color': 'orange',
                            'return_value': True
                        }
                    ],
                    parent_window=self.get_toplevel()
                )

                kdialog.set_action_background('grey')
                do_reboot_now = kdialog.run()
                if do_reboot_now:
                    os.system("sudo systemctl reboot")

            self._trigger_tracking_event()

            Gtk.main_quit()
开发者ID:KanoComputing,项目名称:kano-settings,代码行数:28,代码来源:main_window.py

示例2: _installed_check

    def _installed_check(self):
        if is_app_installed(self._app):
            head = "{} is already installed".format(self._app["title"])
            desc = "Would you like to update it?"
            dialog = KanoDialog(
                head, desc,
                {
                    "YES": {
                        "return_value": 0
                    },
                    "NO": {
                        "return_value": -1
                    }
                },
                parent_window=self
            )
            rv = dialog.run()
            del dialog

            if rv == 0:
                self.set_report_install(False)

            return rv == 0

        return True
开发者ID:carriercomm,项目名称:kano-apps,代码行数:25,代码来源:AppInstaller.py

示例3: __init__

    def __init__(self):

        title_text = 'Hai completato Terminal Quest!'
        description_text = (
            'Stiamo lavorando al prossimo Capitolo. '
            'Nel frattempo, vuoi mandarci qualche suggerimento?'
        )

        KanoDialog.__init__(
            self,
            title_text=title_text,
            description_text=description_text,
            button_dict={
                'LAUNCH FEEDBACK':
                {
                    'color': 'blue',
                    'return_value': 'feedback'
                },
                'CLOSE APPLICATION':
                {
                    'color': 'orange',
                    'return_value': 'close'
                }
            }
            )
开发者ID:iamarf,项目名称:terminal-quest,代码行数:25,代码来源:FinishDialog.py

示例4: apply_changes

    def apply_changes(self, button, event):
        pw_dialog = ParentalPasswordDialog(self.win)
        if not pw_dialog.verify():
            return

        level = self.parental_level.get_value()
        set_parental_level(level)
        set_setting('Parental-level', level)

        # track which parental control level people use
        track_data("parental-control-level-changed", {
            "level": level
        })

        if level == 3.0:
            # If on the highest parental control, prompt user to relaunch
            # the browser
            kdialog = KanoDialog(
                title_text='Settings',
                description_text=("If any browsers are open, please relaunch "
                                  "them for this setting to take effect"),
                parent_window=self.win
            )
            kdialog.run()

        else:
            # Only reboot for the lower parental controls
            common.need_reboot = True

        self.win.go_to_home()
开发者ID:gvsurenderreddy,项目名称:kano-settings,代码行数:30,代码来源:parental_config.py

示例5: apply_changes

    def apply_changes(self, button, event):
        # If enter key is pressed or mouse button is clicked
        if not hasattr(event, 'keyval') or event.keyval == Gdk.KEY_Return:

            if self.ssh_preference is not is_ssh_enabled():
                set_ssh_enabled(self.ssh_preference)

            old_debug_mode = self.get_stored_debug_mode()
            new_debug_mode = self.debug_button.get_active()
            if new_debug_mode == old_debug_mode:
                logging.Logger().debug('skipping debug mode change')
                self.win.go_to_home()
                return

            if new_debug_mode:
                # set debug on:
                logging.set_system_log_level('debug')
                logging.Logger().info("setting logging to debug")
                msg = _("Activated")
            else:
                # set debug off:
                logging.set_system_log_level('error')
                logging.Logger().info("setting logging to error")
                msg = _("De-activated")

            kdialog = KanoDialog(_("Debug mode"), msg, parent_window=self.win)
            kdialog.run()

            self.kano_button.set_sensitive(False)
            self.win.go_to_home()
开发者ID:KanoComputing,项目名称:kano-settings,代码行数:30,代码来源:set_advanced.py

示例6: verify_kit_is_plugged

def verify_kit_is_plugged():
    """
    On Computer Kit 2 Pro, verify that the battery is plugged in and not depleting.
    For now, we rely on the user to tell us.

    Returns:
        is_plugged - bool whether the kit is plugged in (and battery isn't low) or not.
    """
    has_battery = False
    is_battery_low = False
    is_plugged = True

    try:
        from kano_peripherals.wrappers.detection import is_ck2_pro, is_ckt
        has_battery = is_ck2_pro(retry_count=0) or is_ckt(retry_count=0)
    except:
        # Kano Peripherals doesn't support this function
        pass

    if has_battery:
        from kano.gtk3.kano_dialog import KanoDialog
        # Run the first dialog asking the user a question.
        dialog = KanoDialog(
            title_text=_("Power Required"),
            description_text=_("Is your computer plugged in?"),
            button_dict={
                _("Yes"): {'color': 'green', 'return_value': True},
                _("No"): {'color': 'red', 'return_value': False}
            }
        )
        is_plugged = dialog.run()

        try:
            from kano_peripherals.ck2_pro_hat.driver.high_level import get_ck2_pro_hat_interface
            ck2pro_iface = get_ck2_pro_hat_interface(retry_count=0)
            is_battery_low = (ck2pro_iface and ck2pro_iface.is_battery_low())
        except:
            # Kano Peripherals doesn't support this function
            pass

        header = ""
        if is_battery_low:
            header = _("Low Battery")
        else:
            header = _("Power Required")

        # If the answer was negative, show another message.
        if not is_plugged or is_battery_low:
            KanoDialog(
                title_text=header,
                description_text=_(
                    "Sorry! You cannot update unless your computer is plugged in.\n"
                    "Plug it in and try again!"
                ),
                button_dict={
                    _("Continue"): {'color': 'green'}
                }
            ).run()

    return is_plugged and not is_battery_low
开发者ID:KanoComputing,项目名称:kano-updater,代码行数:60,代码来源:utils.py

示例7: _add

    def _add(self, _, playlist_entry):
        playlist_name = playlist_entry.get_text()

        if playlist_name == 'Kano':
            confirm = KanoDialog('You can\'t add to the "Kano" playlist',
                                 '',
                                 {'BACK': {'return_value': True,
                                           'color': 'red'}},
                                 parent_window=self._main_win)
            confirm.run()
            return

        if playlist_name in playlistCollection.collection:
            confirm = KanoDialog(
                'The playlist "{}" already exists!'.format(playlist_name),
                'Do you want to add the video to this playlist or try again?',
                {'USE PLAYLIST': {'return_value': True},
                 'TRY AGAIN': {'return_value': False, 'color': 'red'}},
                parent_window=self._main_win)
            response = confirm.run()
            if not response:
                return
        else:
            playlist = Playlist(playlist_name)
            playlistCollection.add(playlist)

        self._return = playlist_name
        self.destroy()
开发者ID:KanoComputing,项目名称:kano-video,代码行数:28,代码来源:popup.py

示例8: _show_not_internet_dialog

    def _show_not_internet_dialog(self):  # TODO: refactor this
        kd = KanoDialog(
            _("You don't have internet"),
            _("Do you want to connect to WiFi?"),
            [
                {
                    'label': _("YES"),
                    'color': 'green',
                    'return_value': 0
                },
                {
                    'label': _("NO"),
                    'color': 'red',
                    'return_value': 1
                }
            ],
            parent_window=self.win
        )
        response = kd.run()

        # Close the dialog
        while Gtk.events_pending():  # TODO: why is this needed?
            Gtk.main_iteration()

        if response == 0:
            subprocess.Popen("sudo kano-wifi-gui", shell=True)
开发者ID:KanoComputing,项目名称:kano-profile,代码行数:26,代码来源:RegistrationScreen.py

示例9: _new_user_reboot

    def _new_user_reboot(self, event=None, button=None):
        '''
        Schedules kano-init to create a new user from scratch on next reboot,
        then performs the actual reboot
        '''
        confirm = KanoDialog(
            title_text=_('Are you sure you want to create a new account?'),
            description_text=_('A reboot will be required'),
            button_dict=[
                {
                    'label': _('Cancel').upper(),
                    'color': 'red',
                    'return_value': False
                },
                {
                    'label': _('Create').upper(),
                    'color': 'green',
                    'return_value': True
                }
            ])
        confirm.dialog.set_position(Gtk.WindowPosition.CENTER_ALWAYS)

        if confirm.run():
            os.system("sudo kano-init schedule add-user")
            LightDM.restart()
开发者ID:comuri,项目名称:kano-greeter,代码行数:25,代码来源:newuser_view.py

示例10: show_login_status_dialog

    def show_login_status_dialog(self, title, description, return_value):
        '''Show a dialog with the title, description and that returns the
        return_value.
        Since this is used at the end of the login process, we also reset
        the cursor and kano button spinner.
        '''
        kdialog = KanoDialog(title, description,
                             {_("OK"): {"return_value": return_value}},
                             parent_window=self.win)
        response = kdialog.run()

        if response == "SUCCESS":
            if self.first_boot:
                self.win.remove_main_widget()
                SwagScreen(self.win)
            else:
                sys.exit(0)

        # If the login didn't work, try again.
        self.win.get_window().set_cursor(None)
        self.kano_button.stop_spinner()
        self.kano_button.set_sensitive(True)

        if not force_login:
            self.username_entry.grab_focus()
开发者ID:japonophile,项目名称:kano-profile,代码行数:25,代码来源:login.py

示例11: _show_icon_tutorial

    def _show_icon_tutorial(self):
        try:
            from kano_profile.apps import save_app_state_variable, load_app_state_variable

            if load_app_state_variable('kano-apps', 'icon-tutorial-shown'):
                return
            else:
                save_app_state_variable('kano-apps', 'icon-tutorial-shown', True)
        except ImportError:
            # ignore problems importing kano_profile, as we don't want it to
            # be a dependency
            pass

        kdialog = KanoDialog(
            _("Add more apps to the desktop"),
            _(
                "Click the '+' button to the right of the app name to "
                "make it appear on the desktop. You can remove it again "
                "by clicking on 'x'."
            ),
            {
                _("OK, GOT IT"): {
                    "return_value": 0,
                    "color": "green"
                }
            },
            parent_window=self
        )
        kdialog.set_action_background("grey")
        kdialog.title.description.set_max_width_chars(40)
        kdialog.run()
开发者ID:KanoComputing,项目名称:kano-apps,代码行数:31,代码来源:MainWindow.py

示例12: collect_new_username

    def collect_new_username(self):
        username_entry = Gtk.Entry()

        kdialog = KanoDialog(
            title_text=_("Oops, that username has already been taken!"),
            description_text=_("Try picking another one."),
            button_dict=[
                {
                    "label": _("OK").upper()
                },
                {
                    "label": ("Cancel").upper(),
                    "return_value": "CANCEL",
                    "color": "red"
                }
            ],
            widget=username_entry,
            has_entry=True,
            parent_window=self.win
        )
        rv = kdialog.run()
        if rv == "CANCEL":
            # let dialog close, do nothing
            self.page_control.enable_buttons()
            self.data_screen.enable_all()
            self.win.get_window().set_cursor(None)
        else:
            # rv will be the entry contents
            self.win.data["username"] = rv

            # Store this in kano profile straight away
            cache_data("username", rv)
            self.register_handler()
开发者ID:andreiconstantinescu,项目名称:kano-profile,代码行数:33,代码来源:RegistrationScreen2.py

示例13: _show_error_dialog

 def _show_error_dialog(self, title, description):  # TODO: refactor this
     kdialog = KanoDialog(
         title,
         description,
         parent_window=self.win
     )
     kdialog.run()
开发者ID:KanoComputing,项目名称:kano-profile,代码行数:7,代码来源:RegistrationScreen.py

示例14: _update_cb

    def _update_cb(self, widget):
        confirmation = KanoDialog(
            title_text=_("Updating {}").format(self._app["title"]),
            description_text=_(
                "This application will be updated "
                "Do you wish to proceed?"
            ),
            button_dict={
                _("YES"): {
                    "return_value": 0
                },
                _("NO"): {
                    "return_value": -1,
                    "color": "red"
                }
            },
            parent_window=self._window
        )
        confirmation.title.description.set_max_width_chars(40)

        rv = confirmation.run()
        del confirmation
        if rv < 0:
            return

        self._install_app(report_install=False)
开发者ID:KanoComputing,项目名称:kano-apps,代码行数:26,代码来源:AppGrid.py

示例15: _create_dialog

 def _create_dialog(self, title, description):  # TODO: refactor this
     kdialog = KanoDialog(
         title,
         description,
         parent_window=self.win
     )
     rv = kdialog.run()
     return rv
开发者ID:KanoComputing,项目名称:kano-profile,代码行数:8,代码来源:RegistrationScreen.py


注:本文中的kano.gtk3.kano_dialog.KanoDialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。