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

« back to all changes in this revision

Viewing changes to glchess/src/lib/gtkui/dialogs.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:
120
120
            
121
121
        # Create model for game time
122
122
        defaultTime = glchess.config.get('new_game_dialog/move_time')
 
123
                  # Translators: Time Combo: There is no time limit
123
124
        times = [(_('Unlimited'),       0),
 
125
                  # Translators: Time Combo: Game will last one minute
124
126
                 (_('One minute'),     60),
 
127
                  # Translators: Time Combo: Game will last five minutes
125
128
                 (_('Five minutes'),  300),
 
129
                  # Translators: Time Combo: Game will last 30 minutes
126
130
                 (_('30 minutes'),   1800),
 
131
                  # Translators: Time Combo: Game will last one hour
127
132
                 (_('One hour'),     3600),
 
133
                  # Translators: Time Combo: User will configure game duration
128
134
                 (_('Custom'),         -1)]
129
135
        timeModel = gtk.ListStore(str, int)
130
136
        activeIter = None
145
151
        widget.add_attribute(cell, 'text', 0)
146
152
 
147
153
        model = gtk.ListStore(str, int)
 
154
                  # Translators: Custom Time Combo: User specifying number of seconds for game duration
148
155
        units = [(_('seconds'),  1),
 
156
                  # Translators: Custom Time Combo: User specifying number of minutes for game duration
149
157
                 (_('minutes'), 60),
 
158
                  # Translators: Custom Time Combo: User specifying number of hours for game duration
150
159
                 (_('hours'), 3600)]
151
160
        for (name, multiplier) in units:
152
161
            iter = model.append()
164
173
 
165
174
        # Create the model for difficulty options
166
175
        levelModel = gtk.ListStore(str, str, str)
 
176
                  # Translators: AI Difficulty Combo: AI set to easy difficulty
167
177
        levels = [('easy',   _('Easy'),   'weather-few-clouds'),
 
178
                  # Translators: AI Difficulty Combo: AI set to normal diffuculty
168
179
                  ('normal', _('Normal'), 'weather-overcast'),
 
180
                  # Translators: AI Difficulty Combo: AI set to hard diffuculty
169
181
                  ('hard',   _('Hard'),   'weather-storm')]
170
182
        for (key, label, icon) in levels:
171
183
            iter = levelModel.append()
238
250
            
239
251
            # Change title for loaded games
240
252
            if g.path is not None:
 
253
                # Translators: This is the title of the dialog when continuing a loaded game
241
254
                self.window.set_title(_('Configure loaded game (%i moves)') % len(g.moves))
242
255
 
243
256
        # Display warning if missing the AIs
250
263
        self.window.present()
251
264
        self.__checking = False
252
265
        self.__testReady()
253
 
        
 
266
 
254
267
    # Private methods
255
268
    
256
269
    def __setCombo(self, comboName, key):
296
309
        if self.__customName:
297
310
            name = self.__gui.get_widget('game_name_entry').get_text()
298
311
            if len(name) == 0:
299
 
                # Next time the something changes generate a name
 
312
                # Next time something changes generate a name
300
313
                self.__customName = False
301
314
                ready = False
302
315
 
304
317
        else:
305
318
            whiteName = self.__getComboData(self.__gui.get_widget('white_type_combo'), 2)
306
319
            blackName = self.__getComboData(self.__gui.get_widget('black_type_combo'), 2)
 
320
            # Translators: Default name for a new game. %(white) and %(black) are substituted for the names of the white and black players.
307
321
            format = _('%(white)s versus %(black)s')
308
322
            self.__gui.get_widget('game_name_entry').set_text(format % {'white': whiteName, 'black': blackName})
309
323
 
327
341
        # Get the players
328
342
        game.white.type  = self.__getComboData(self.__gui.get_widget('white_type_combo'), 0)
329
343
        if game.white.type == '':
 
344
            # Translators: Default name for the white player
330
345
            game.white.name = _('White')
331
346
        else:
332
347
            game.white.name = self.__getComboData(self.__gui.get_widget('white_type_combo'), 2)
333
348
        game.white.level = self.__getComboData(self.__gui.get_widget('white_difficulty_combo'), 0)
334
349
        game.black.type  = self.__getComboData(self.__gui.get_widget('black_type_combo'), 0)
335
350
        if game.black.type == '':
 
351
            # Translators: Default name for the black player
336
352
            game.black.name = _('Black')
337
353
        else:
338
354
            game.black.name = self.__getComboData(self.__gui.get_widget('black_type_combo'), 2)
384
400
        if responseId == gtk.RESPONSE_OK:
385
401
            self.__startGame()
386
402
        dialog.destroy()
 
403
        if self.__mainUI.newGameDialog is self:
 
404
            self.__mainUI.newGameDialog = None
387
405
 
388
406
class GtkLoadGameDialog:
389
407
    """
440
458
 
441
459
            fileName = self.__gui.get_widget('filechooserwidget').get_filename()
442
460
            if fileName is None:
 
461
                # Translators: Message displayed in load game dialog when no file is selected
443
462
                error = _('Please select a file to load')
444
463
            else:
445
464
                error = self.__mainUI.feedback.loadGame(fileName, responseId == gtk.RESPONSE_YES)
447
466
            if error is not None:
448
467
                self.firstExpose = True
449
468
                self.__gui.get_widget('error_box').show()
 
469
                # Translators: Title of error box when unable to load game
450
470
                self.__gui.get_widget('error_title_label').set_markup('<big><b>%s</b></big>' % _('Unabled to load game'))
451
471
                self.__gui.get_widget('error_description_label').set_markup('<i>%s</i>' % error)
452
472
                return
453
473
 
454
474
        dialog.destroy()
 
475
        if self.__mainUI.loadGameDialog is self:
 
476
            self.__mainUI.loadGameDialog = None
455
477
        
456
478
class GtkSaveGameDialog:
457
479
    """
514
536
            # Append .pgn to the end if not provided
515
537
            fname = chooser.get_filename()
516
538
            if fname is None:
 
539
                # Translators: Save Game Dialog: Error displayed when no file name entered
517
540
                self.__setError(_('Please enter a file name'), '')
518
541
                return
519
542
            if fname[-4:].lower() != '.pgn':
526
549
 
527
550
            error = self.__mainUI._saveView(self.__view, fname)
528
551
            if error is not None:
 
552
                # Translators: Save Game Dialog: Error title when unable to save game
529
553
                self.__setError(_('Unabled to save game'), error)
530
554
                return
531
555
        else:
551
575
        moveModel = gtk.ListStore(str, str)
552
576
        widget = self.__gui.get_widget('move_format_combo')
553
577
        widget.set_model(moveModel)
 
578
                        # Translators: Move Format Combo: Moves shown in human descriptive notation
554
579
        move_formats = [('human', _('Human')),
 
580
                        # Translators: Move Format Combo: Moves shown in long algebraic notation (LAN)
555
581
                        ('lan', _('Long Algebraic')),
 
582
                        # Translators: Move Format Combo: Moves shown in standard algebraic notation (SAN)
556
583
                        ('san', _('Standard Algebraic'))]
557
584
        for (key, label) in move_formats:
558
585
            iter = moveModel.append()
559
586
            moveModel.set(iter, 0, label, 1, key)
560
587
 
561
 
        # Make modelfor board orientation
 
588
        # Make model for board orientation
562
589
        boardModel = gtk.ListStore(str, str)
563
590
        widget = self.__gui.get_widget('board_combo')
564
591
        widget.set_model(boardModel)
 
592
                     # Translators: Board Side Combo: Camera will face white player's side
565
593
        view_list = [('white', _('White Side')),
 
594
                     # Translators: Board Side Combo: Camera will face black player's side
566
595
                     ('black', _('Black Side')),
 
596
                     # Translators: Board Side Combo: Camera will face human player's side
567
597
                     ('human', _('Human Side')),
 
598
                     # Translators: Board Side Combo: Camera will face current player's side
568
599
                     ('current', _('Current Player'))]
569
600
        for (key, label) in view_list:
570
601
            iter = boardModel.append()
574
605
        promotionModel = gtk.ListStore(str, str)
575
606
        widget = self.__gui.get_widget('promotion_type_combo')
576
607
        widget.set_model(promotionModel)
 
608
                          # Translators: Promotion Combo: Promote to a queen
577
609
        promotion_list = [('queen', _('Queen')),
 
610
                          # Translators: Promotion Combo: Promote to a knight
578
611
                          ('knight', _('Knight')),
 
612
                          # Translators: Promotion Combo: Promote to a rook
579
613
                          ('rook', _('Rook')),
 
614
                          # Translators: Promotion Combo: Promote to a bishop
580
615
                          ('bishop', _('Bishop'))]
581
616
        for (key, label) in promotion_list:
582
617
            iter = promotionModel.append()