コード例 #1
0
    def createThemesMenu(self, menu):
        submenu = MfxMenu(menu, label=n_("Set t&heme"))

        try:
            from ttkthemes import themed_style
            style_path = themed_style.ThemedStyle(self.top)
        except ImportError:
            style_path = ttk.Style(self.top)
        all_themes = list(style_path.theme_names())

        all_themes.sort()
        #
        tn = {
            'alt': n_('Alt/Revitalized'),
            'itft1': n_('ITFT1'),
            'scidblue': n_('Scid Blue'),
            'scidgreen': n_('Scid Green'),
            'scidgrey': n_('Scid Grey'),
            'scidmint': n_('Scid Mint'),
            'scidpink': n_('Scid Pink'),
            'scidpurple': n_('Scid Purple'),
            'scidsand': n_('Scid Sand'),
            'winnative': n_('Windows Native'),
            'winxpblue': n_('Windows XP Blue'),
            'xpnative': n_('XP Native'),
        }
        for t in all_themes:
            try:
                n = tn[t]
            except KeyError:
                n = t.capitalize()
            submenu.add_radiobutton(label=n,
                                    variable=self.tkopt.theme,
                                    value=t,
                                    command=self.mOptTheme)
コード例 #2
0
    def __init__(self, top, menubar, dir,
                 size=0, relief='flat', compound='none'):
        self.top = top
        self.menubar = menubar
        self.side = -1
        self._tooltips = []
        self._widgets = []
        self.dir = dir
        self.size = size
        self.compound = compound
        self.orient = 'horizontal'
        #
        self.frame = ttk.Frame(top, class_='Toolbar',
                               relief=TkSettings.toolbar_relief,
                               borderwidth=TkSettings.toolbar_borderwidth)
        #
        for l, f, t in (
            (n_("New"),      self.mNewGame,   _("New game")),
            (n_("Restart"),  self.mRestart,   _("Restart the\ncurrent game")),
            (None,           None,            None),
            (n_("Open"),     self.mOpen,      _("Open a\nsaved game")),
            (n_("Save"),     self.mSave,      _("Save game")),
            (None,           None,            None),
            (n_("Undo"),     self.mUndo,      _("Undo last move")),
            (n_("Redo"),     self.mRedo,      _("Redo last move")),
            (n_("Autodrop"), self.mDrop,      _("Auto drop cards")),
            (n_("Shuffle"),  self.mShuffle,   _("Shuffle tiles")),
            (n_("Pause"),    self.mPause,     _("Pause game")),
            (None,           None,            None),
            (n_("Statistics"), self.mPlayerStats, _("View statistics")),
            (n_("Rules"),    self.mHelpRules, _("Rules for this game")),
            (None,           None,            None),
            (n_("Quit"),     self.mQuit,      _("Quit ")+TITLE),
                ):
            if l is None:
                sep = self._createSeparator()
                sep.bind("<3>", self.rightclickHandler)
            elif l == 'Pause':
                self._createButton(l, f, check=True, tooltip=t)
            else:
                self._createButton(l, f, tooltip=t)
        self.pause_button.config(variable=menubar.tkopt.pause)

        self.popup = MfxMenu(master=None, label=n_('Toolbar'), tearoff=0)
        createToolbarMenu(menubar, self.popup)

        position = len(self._widgets)
        self.frame.rowconfigure(position, weight=1)
        self.frame.columnconfigure(position, weight=1)
        #
        self._createLabel("player", label=n_('Player'),
                          tooltip=_("Player options"))
        #
        self.player_label.bind("<1>", self.mOptPlayerOptions)
        self.frame.bind("<3>", self.rightclickHandler)
        #
        self.setCompound(compound, force=True)
コード例 #3
0
ファイル: menubar.py プロジェクト: proteanblank/PySolFC
 def createThemesMenu(self, menu):
     submenu = MfxMenu(menu, label=n_("Set t&heme"))
     all_themes = list(ttk.Style(self.top).theme_names())
     all_themes.sort()
     #
     tn = {
         'default': n_('Default'),
         'classic': n_('Classic'),
         'alt': n_('Revitalized'),
         'winnative': n_('Windows native'),
         'xpnative': n_('XP Native'),
         'aqua': n_('Aqua'),
     }
     for t in all_themes:
         try:
             n = tn[t]
         except KeyError:
             n = t.capitalize()
         submenu.add_radiobutton(label=n,
                                 variable=self.tkopt.theme,
                                 value=t,
                                 command=self.mOptTheme)
コード例 #4
0
ファイル: toolbar.py プロジェクト: proteanblank/PySolFC
    def __init__(self,
                 top,
                 menubar,
                 dir,
                 size=0,
                 relief='flat',
                 compound='none'):
        self.top = top
        self.menubar = menubar
        self.side = -1
        self._tooltips = []
        self._widgets = []
        self.dir = dir
        self.size = size
        self.compound = compound
        self.orient = 'horizontal'
        self.button_pad = 2
        #
        self.frame = tkinter.Frame(top,
                                   relief=TkSettings.toolbar_relief,
                                   bd=TkSettings.toolbar_borderwidth)

        from pysollib.options import calcCustomMouseButtonsBinding

        def _bind2sep(sep):
            sep.bind(calcCustomMouseButtonsBinding("<{mouse_button1}>"),
                     self.clickHandler)
            sep.bind(calcCustomMouseButtonsBinding("<{mouse_button3}>"),
                     self.rightclickHandler)

        for label, f, t in (
            (n_("New"), self.mNewGame, _("New game")),
            (n_("Restart"), self.mRestart, _("Restart the\ncurrent game")),
            (None, None, None),
            (n_("Open"), self.mOpen, _("Open a\nsaved game")),
            (n_("Save"), self.mSave, _("Save game")),
            (None, None, None),
            (n_("Undo"), self.mUndo, _("Undo last move")),
            (n_("Redo"), self.mRedo, _("Redo last move")),
            (n_("Autodrop"), self.mDrop, _("Auto drop cards")),
            (n_("Shuffle"), self.mShuffle, _("Shuffle tiles")),
            (n_("Pause"), self.mPause, _("Pause game")),
            (None, None, None),
            (n_("Statistics"), self.mPlayerStats, _("View statistics")),
            (n_("Rules"), self.mHelpRules, _("Rules for this game")),
            (None, None, None),
            (n_("Quit"), self.mQuit, _("Quit %s") % TITLE),
        ):
            if label is None:
                sep = self._createSeparator()
                _bind2sep(sep)
            elif label == 'Pause':
                self._createButton(label, f, check=True, tooltip=t)
            else:
                self._createButton(label, f, tooltip=t)
        self.pause_button.config(variable=menubar.tkopt.pause)

        sep = self._createFlatSeparator()
        _bind2sep(sep)
        self._createLabel("player",
                          label=n_('Player'),
                          tooltip=_("Player options"))
        #
        self.player_label.bind(
            calcCustomMouseButtonsBinding("<{mouse_button1}>"),
            self.mOptPlayerOptions)
        # self.player_label.bind("<3>",self.mOptPlayerOptions)
        self.popup = MfxMenu(master=None, label=n_('Toolbar'), tearoff=0)
        createToolbarMenu(menubar, self.popup)
        _bind2sep(self.frame)
        #
        self.setCompound(compound, force=True)