~ubuntu-branches/ubuntu/intrepid/gnome-games/intrepid

« back to all changes in this revision

Viewing changes to glchess/src/lib/gtkui/gtkui.py

  • Committer: Package Import Robot
  • Author(s): Didier Roche
  • Date: 2008-10-21 00:30:34 UTC
  • mfrom: (1.1.58)
  • Revision ID: package-import@ubuntu.com-20081021003034-cb0iknvzten935zn
Tags: 1:2.24.1-0ubuntu1
* New upstream release (LP: #286667)
  - General:
    - Fix up compatiblity with Gtk/Glib 2.14
    - Reclassify Gnibbles as Arcade game not logic game
    - Read saved window configuration from correct GConf group (affects
      gnometris, gnibbles, gnobots)
  - Aisleriot:
    - Remove vestigal flowRoot elements from solitaire svg icons. They
      caused a black box when rendering.
    - Don't crash when the session manager terminates aisleriot
  - GLChess:
    - Fix crash in error handler when GGZ connection closed
    - Fix crash in empty scene when no AI engines available
    - Fix crash when have OpenGL libraries but cannot get valid display
    - Implement GGZ config parser instead of using Python config parser
      which does not handle '%' characters as GGZ does
    - Ignore GGZ server remove player/table for unknown players/tables
    - Handle exceptions loading OpenGL textures
    - Reset pause menu when starting new game
    - Only allow one new/load game dialog to be visible at once
    - Fix incorrect function call for single buffered 3D display
    - Handle fork() errors in AI processes
    - Fixes to compile in Solaris
    - Print failure to start message to stdout if cannot import GTK+
    - Handle invalid response from glRenderMode(GL_RENDER) and print
      debugging information
    - More logging messages about selection rendering bugs
    - After looking at failure case in PyOpenGL code we don't need to change
      render modes after failed to change to GL_SELECT
    - Fix potential bugs found by PyChecker
    - Fix crash when validly claiming a draw
    - Don't display failed to claim draw dialog when successfully claimed
      draw
  - GTali:
    - Undoing 5 of a kind reduces the score by 50 as there might be multiple
      scores (LP: #238978)
  - Sudoku:
    - Add not overwrite time and also remember to actually save the time in
      the file (LP: #279616)
    - Correct typo in error message that led to an exception
  - Gnotravex:
    - Stop paused tiles becoming visible after changing colour settings
  - Blackjack:
    - Fix compiler warnings

Show diffs side-by-side

added added

removed removed

Lines of Context:
203
203
        self.feedback = feedback
204
204
        self._watches = {}
205
205
        self.__networkGames = {}
 
206
        self.newGameDialog = None
 
207
        self.loadGameDialog = None
206
208
        self.__saveGameDialogs = {}
207
209
        self.__joinGameDialogs = []
208
210
        
229
231
        # Create the model for the player types
230
232
        self.__playerModel = gtk.ListStore(str, str, str)
231
233
        iter = self.__playerModel.append()
 
234
        # Translators: Player Type Combo: Player is human controlled
232
235
        self.__playerModel.set(iter, 0, '', 1, 'stock_person', 2, _('Human'))
233
236
        
234
237
        self.__logWindow = log.LogWindow(self._gui.get_widget('log_notebook'))
357
360
        # Set the window title to the name of the game
358
361
        if self.view is not None and len(self.view.title) > 0:
359
362
            if self.view.needsSaving:
360
 
                # Translators: This is the window title when playing a game that needs saving
 
363
                # Translators: Window title when playing a game that needs saving
361
364
                title = _('Chess - *%(game_name)s') % {'game_name': self.view.title}
362
365
            else:
363
 
                # Translators: This is the window title when playing a game that is saved
 
366
                # Translators: Window title when playing a game that is saved
364
367
                title = _('Chess - %(game_name)s') % {'game_name': self.view.title}
365
368
        else:
366
 
            # Translators: This is the window title when not playing a game
 
369
            # Translators: Window title when not playing a game
367
370
            title = _('Chess')            
368
371
        self.mainWindow.set_title(title)
369
372
 
461
464
                                   type = gtk.MESSAGE_WARNING,
462
465
                                   message_format = title)
463
466
        dialog.format_secondary_text("If you don't save the changes to this game will be permanently lost")
 
467
        # Translators: Save Game Dialog: Discard game button
464
468
        dialog.add_button(_('Close _without saving'), gtk.RESPONSE_OK)
465
469
        dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
466
470
        dialog.add_button(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT)
575
579
        # Enable/disable OpenGL rendering
576
580
        elif name == 'show_3d':            
577
581
            if value and not chessview.haveGLSupport:
 
582
                # Translators: No 3D Dialog: Title
578
583
                title = _('Unable to enable 3D mode')
579
584
                errors = '\n'.join(chessview.openGLErrors)
 
585
                # Translators: No 3D Dialog: Notification to user that they do not have libraries required to enable 3D.
 
586
                # %(error)s will be replaced with a list of reasons why 3D is not available.
580
587
                description = _("""You are unable to play in 3D mode due to the following problems:
581
588
%(errors)s
582
589
 
583
 
Please contact your system administrator to resolve these problems, until then you will be able to play chess in 2D mode.""" % {'errors': errors})
 
590
Please contact your system administrator to resolve these problems, until then you will be able to play chess in 2D mode.""") % {'errors': errors}
584
591
                dialog = gtk.MessageDialog(type = gtk.MESSAGE_WARNING, message_format = title)
585
592
                dialog.format_secondary_text(description)
586
593
                dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
784
791
 
785
792
    def _on_new_game_button_clicked(self, widget):
786
793
        """Gtk+ callback"""
787
 
        dialogs.GtkNewGameDialog(self, self.__playerModel)
 
794
        if self.newGameDialog:
 
795
            self.newGameDialog.window.present()
 
796
        else:
 
797
            self.newGameDialog = dialogs.GtkNewGameDialog(self, self.__playerModel)
788
798
 
789
799
    def _on_join_game_button_clicked(self, widget):
790
800
        """Gtk+ callback"""
792
802
 
793
803
    def _on_open_game_button_clicked(self, widget):
794
804
        """Gtk+ callback"""
795
 
        dialogs.GtkLoadGameDialog(self)
 
805
        if self.loadGameDialog:
 
806
            self.loadGameDialog.window.present()
 
807
        else:
 
808
            self.loadGameDialog = dialogs.GtkLoadGameDialog(self)
796
809
        
797
810
    def _on_save_game_button_clicked(self, widget):
798
811
        """Gtk+ callback"""
799
812
        if self.view.feedback.getFileName() is not None:
800
813
            self.view.feedback.save()
801
 
        elif not self.__saveGameDialogs.has_key(self.view):
802
 
            self.__saveGameDialogs[self.view] = dialogs.GtkSaveGameDialog(self, self.view)
803
 
            
 
814
            return
 
815
        
 
816
        try:
 
817
            dialog = self.__saveGameDialogs[self.view]
 
818
        except KeyError:
 
819
            dialog = self.__saveGameDialogs[self.view] = dialogs.GtkSaveGameDialog(self, self.view)
 
820
        dialog.window.present()
 
821
 
804
822
    def _on_save_as_game_button_clicked(self, widget):
805
823
        """Gtk+ callback"""
806
 
        if not self.__saveGameDialogs.has_key(self.view):
807
 
            self.__saveGameDialogs[self.view] = dialogs.GtkSaveGameDialog(self, self.view, self.view.feedback.getFileName())
 
824
        try:
 
825
            dialog = self.__saveGameDialogs[self.view]
 
826
        except KeyError:
 
827
            dialog = self.__saveGameDialogs[self.view] = dialogs.GtkSaveGameDialog(self, self.view, self.view.feedback.getFileName())
 
828
        dialog.window.present()
808
829
 
809
830
    def _on_resign_clicked(self, widget):
810
831
        """Gtk+ callback"""
812
833
 
813
834
    def _on_claim_draw_clicked(self, widget):
814
835
        """Gtk+ callback"""
815
 
        if not self.view.feedback.claimDraw():
816
 
            dialog = gtk.MessageDialog(flags = gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
817
 
                                       type = gtk.MESSAGE_WARNING,
818
 
                                       message_format = _("Unable to claim draw"))
819
 
        dialog.format_secondary_text(_("""You may claim a draw when:
 
836
        if self.view.feedback.claimDraw():
 
837
            return
 
838
        
 
839
        # Translators: Draw Dialog: Title
 
840
        title = _("Unable to claim draw")
 
841
        # Translators: Draw Dialog: Notify user why they cannot claim draw
 
842
        message = _("""You may claim a draw when:
820
843
a) The board has been in the same state three times (Three fold repitition)
821
 
b) Fifty moves have occured where no pawn has moved and no piece has been captured (50 move rule)"""))
 
844
b) Fifty moves have occured where no pawn has moved and no piece has been captured (50 move rule)""")
 
845
        
 
846
        dialog = gtk.MessageDialog(flags = gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
 
847
                                   type = gtk.MESSAGE_WARNING,
 
848
                                   message_format = title)
 
849
        dialog.format_secondary_text(message)
822
850
        dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_ACCEPT)
823
851
        dialog.run()
824
852
        dialog.destroy()