def mDone(self, button):
     if button in (0, 1):  # Load/Cancel
         self.key = self.tree.selection_key
         self.tree.n_expansions = 1  # save xyview in any case
         if USE_PIL:
             auto_scale = bool(self.auto_scale.get())
             if button == 1:
                 self.app.menubar.tkopt.auto_scale.set(auto_scale)
             if auto_scale:
                 self.scale_values = (self.app.opt.scale_x,
                                      self.app.opt.scale_y, auto_scale,
                                      bool(self.preserve_aspect.get()))
             else:
                 self.scale_values = (self.scale_x.get(),
                                      self.scale_y.get(), auto_scale,
                                      self.app.opt.preserve_aspect_ratio)
     if button in (3, 4):
         cs = self.manager.get(self.tree.selection_key)
         if not cs:
             return
         # title = CARDSET+" "+cs.name
         title = CARDSET.capitalize() + " " + cs.name
         CardsetInfoDialog(self.top,
                           title=title,
                           cardset=cs,
                           images=self.preview_images)
         return
     MfxDialog.mDone(self, button)
Example #2
0
 def mDone(self, button):
     if button in (0, 1):            # Load/Cancel
         self.key = self.tree.selection_key
         self.tree.n_expansions = 1  # save xyview in any case
         if USE_PIL:
             auto_scale = bool(self.auto_scale.get())
             if button == 1:
                 self.app.menubar.tkopt.auto_scale.set(auto_scale)
             if auto_scale:
                 self.scale_values = (self.app.opt.scale_x,
                                      self.app.opt.scale_y,
                                      auto_scale,
                                      bool(self.preserve_aspect.get()))
             else:
                 self.scale_values = (self.scale_x.get(),
                                      self.scale_y.get(),
                                      auto_scale,
                                      self.app.opt.preserve_aspect_ratio)
     if button in (3, 4):
         cs = self.manager.get(self.tree.selection_key)
         if not cs:
             return
         ##title = CARDSET+" "+cs.name
         title = CARDSET.capitalize()+" "+cs.name
         CardsetInfoDialog(self.top, title=title, cardset=cs, images=self.preview_images)
         return
     MfxDialog.mDone(self, button)
Example #3
0
 def mDone(self, button):
     if button in (0, 1):               # Ok/Load
         self.key = self.tree.selection_key
         self.tree.n_expansions = 1  # save xyview in any case
     if button in (3, 4):
         cs = self.manager.get(self.tree.selection_key)
         if not cs:
             return
         ##title = CARDSET+" "+cs.name
         title = CARDSET.capitalize()+" "+cs.name
         CardsetInfoDialog(self.top, title=title, cardset=cs, images=self.preview_images)
         return
     MfxDialog.mDone(self, button)
Example #4
0
    def mDone(self, button):
        if button in (0, 1):  # Load/Cancel
            self.key = self.tree.selection_key
            self.tree.n_expansions = 1  # save xyview in any case

            # save the values
            try:
                self.cardset_values = self.x_offset.get(), self.y_offset.get()
            except Exception:
                pass

            if USE_PIL:
                auto_scale = bool(self.auto_scale.get())
                if button == 1:  # Cancel
                    # no changes
                    self.cardset_values = None
                elif button == 0:  # OK
                    self.app.menubar.tkopt.auto_scale.set(auto_scale)

                    self.app.opt.scale_x = self.scale_x.get()
                    self.app.opt.scale_y = self.scale_y.get()
                    self.app.opt.preserve_aspect_ratio = \
                        self.preserve_aspect.get()

                    self.scale_values = (self.app.opt.scale_x,
                                         self.app.opt.scale_y, auto_scale,
                                         self.app.opt.preserve_aspect_ratio)
                    self.app.game.resizeGame(card_size_manually=True)
                    self.app.game.resizeGame(card_size_manually=False)

        if button == 10:  # Info
            cs = self.manager.get(self.tree.selection_key)
            if not cs:
                return
            # title = CARDSET+" "+cs.name
            title = CARDSET.capitalize() + " " + cs.name
            d = CardsetInfoDialog(self.top,
                                  title=title,
                                  cardset=cs,
                                  images=self.preview_images)
            try:
                self.cardset_values = d.cardset_values
            except Exception:
                self.cardset_values = None

            return
        MfxDialog.mDone(self, button)
Example #5
0
    def mDone(self, button):
        if button in (0, 1):  # Load/Cancel
            self.key = self.tree.selection_key
            self.tree.n_expansions = 1  # save xyview in any case

            if button == 0:
                cardset = self.app.cardset_manager.get(self.key)
                if self.app.game is not None:
                    gi = self.app.getGameInfo(self.app.game.id)
                else:
                    gi = self.app.getGameInfo(self.app.nextgame.id)
                cs, cs_update_flag, t = \
                    self.app.getCompatibleCardset(gi, cardset, trychange=False)

                if cs is None:
                    self.app.requestCompatibleCardsetTypeDialog(cardset, gi, t)
                    return

            # save the values
            try:
                self.cardset_values = self.x_offset.get(), self.y_offset.get()
            except Exception:
                pass

            if USE_PIL:
                auto_scale = bool(self.auto_scale.get())
                if button == 1:
                    # no changes
                    self.cardset_values = None

                elif button == 0:
                    self.app.menubar.tkopt.auto_scale.set(auto_scale)

                    if auto_scale:
                        self.app.menubar.tkopt.spread_stacks.set(False)
                        self.scale_values = (self.app.opt.scale_x,
                                             self.app.opt.scale_y, auto_scale,
                                             False,
                                             bool(self.preserve_aspect.get()))
                    else:
                        self.scale_values = (
                            self.scale_x.get(), self.scale_y.get(), auto_scale,
                            self.app.opt.spread_stacks,
                            self.app.opt.preserve_aspect_ratio)
        if button == 10:  # Info
            cs = self.manager.get(self.tree.selection_key)
            if not cs:
                return
            # title = CARDSET+" "+cs.name
            title = CARDSET.capitalize() + " " + cs.name
            d = CardsetInfoDialog(self.top,
                                  title=title,
                                  cardset=cs,
                                  images=self.preview_images)
            try:
                self.cardset_values = d.cardset_values
            except Exception:
                self.cardset_values = None

            return
        MfxDialog.mDone(self, button)