Ejemplo n.º 1
0
    def __init__(self, pygame, res, surface, size):
        Screen.__init__(self, pygame, res, surface, size)

        self.texts['Heading1'] = Text(
            pygame, res, surface, (self.center_x + 3, 70 + 3), 'Credits', res.heading1_font, res.BLACK)

        self.texts['Heading2'] = Text(
            pygame, res, surface, (self.center_x, 70), 'Credits', res.heading1_font, res.game_title_text_color)

        self.texts['Body'] = Text(
            pygame, res, surface, (self.center_x, 130), 'People who have contributed to this project', res.body_font, res.body_text_color)

        self.buttons['Contribute'] = Button(
            pygame, res, surface, (self.center_x, 200), "Contribute")
        self.buttons['Vineet'] = Button(
            pygame, res, surface, (self.center_x - 150, 300), "Vineet")
        self.buttons['Amrit'] = Button(
            pygame, res, surface, (self.center_x + 150, 300), "Amrit")
        self.buttons['Kartik'] = Button(
            pygame, res, surface, (self.center_x - 150, 380), "Kartik")
        self.buttons['Venturillo'] = Button(
            pygame, res, surface, (self.center_x + 150, 380), "Venturillo")
        self.buttons['Shikhar'] = Button(
            pygame, res, surface, (self.center_x - 150, 460), "Shikhar")
        self.buttons['Divyang'] = Button(
            pygame, res, surface, (self.center_x + 150, 460), "Divyang")
        self.buttons['Azmal'] = Button(
            pygame, res, surface, (self.center_x - 150, 540), "Azmal")
        self.buttons['Abhinandan'] = Button(
            pygame, res, surface, (self.center_x + 150, 540), "Abhinandan")
        self.buttons['Back'] = Button(
            pygame, res, surface, (self.center_x, 700), "Back")
Ejemplo n.º 2
0
 def __init__(self, pygame, res, surface, game_manager):
     Screen.__init__(self, pygame, res, surface)
     self.game_manager = game_manager
     self.buttons['Restart'] = Button(
         pygame, res, surface, [20, 290, 300, 50], "Restart")
     self.buttons['Back'] = Button(
         pygame, res, surface, [20, 360, 300, 50], "Back")
 def __init__(self, pygame, res, surface, game_manager):
     Screen.__init__(self, pygame, res, surface)
     self.game_manager = game_manager
     self.font = pygame.font.SysFont('cambria', 60)
     self.font2 = pygame.font.SysFont('cambria', 30)
     self.buttons['Restart'] =   Button(pygame, res, surface, [20, 290, 300, 50], "Restart")
     self.buttons['Back'] =      Button(pygame, res, surface, [20, 360, 300, 50], "Back")
Ejemplo n.º 4
0
 def __init__(self, pygame, res, surface):
     Screen.__init__(self, pygame, res, surface)
     self.font = pygame.font.SysFont('cambria', 60)
     self.font2 = pygame.font.SysFont('cambria', 30)
     self.buttons['Start Game'] =    Button(pygame, res, surface, [20, 150, 300, 50], "Start Game")
     self.buttons['Tutorial'] =      Button(pygame, res, surface, [20, 220, 300, 50], "Tutorial")
     self.buttons['Settings'] =      Button(pygame, res, surface, [20, 290, 300, 50], "Settings")
     self.buttons['Credits'] =       Button(pygame, res, surface, [20, 360, 300, 50], "Credits")
     self.buttons['Exit'] =          Button(pygame, res, surface, [20, 430, 300, 50], "Exit")
 def __init__(self, pygame, res, surface, game_manager):
     Screen.__init__(self, pygame, res, surface)
     self.game_manager = game_manager
     self.font = pygame.font.SysFont('cambria', 60)
     self.buttons['Easy'] = Button(pygame, res, surface,
                                   [362, 150, 300, 50], "Easy")
     self.buttons['Medium'] = Button(pygame, res, surface,
                                     [362, 220, 300, 50], "Medium")
     self.buttons['Hard'] = Button(pygame, res, surface,
                                   [362, 290, 300, 50], "Hard")
     self.buttons['Back'] = Button(pygame, res, surface,
                                   [362, 360, 300, 50], "Back")
Ejemplo n.º 6
0
    def __init__(self, pygame, res, surface, size, game_manager):
        Screen.__init__(self, pygame, res, surface, size)
        self.game_manager = game_manager

        self.texts['Heading1'] = Text(pygame, res, surface,
                                      (self.center_x + 3, 70 + 3),
                                      'Select Game Mode', res.heading1_font,
                                      res.BLACK)

        self.texts['Heading2'] = Text(pygame, res, surface,
                                      (self.center_x, 70), 'Select Game Mode',
                                      res.heading1_font,
                                      res.game_title_text_color)

        self.texts['Body'] = Text(pygame, res, surface, (self.center_x, 130),
                                  'Choose your game mode', res.body_font,
                                  res.body_text_color)

        self.texts['Game Mode'] = Text(pygame, res, surface,
                                       (self.center_x, 240), 'Game mode',
                                       res.heading3_font,
                                       res.heading3_text_color)

        self.texts['Difficulty'] = Text(pygame, res, surface,
                                        (self.center_x, 520), 'Difficulty',
                                        res.heading3_font,
                                        res.heading3_text_color)

        self.buttons['Classic'] = Button(pygame, res, surface,
                                         (self.center_x - 250, 320), "Classic")
        self.buttons['Infinite'] = Button(pygame, res, surface,
                                          (self.center_x + 000, 320),
                                          "Infinite")
        self.buttons['1v1'] = Button(pygame, res, surface,
                                     (self.center_x + 250, 320), "1 vs 1")

        self.buttons['AI'] = Button(pygame, res, surface,
                                    (self.center_x - 250, 400), "AI")
        self.buttons['Hardcore'] = Button(pygame, res, surface,
                                          (self.center_x + 000, 400),
                                          "Hardcore")
        self.buttons['Heist'] = Button(pygame, res, surface,
                                       (self.center_x + 250, 400), "Heist")

        self.buttons['Easy'] = Button(pygame, res, surface,
                                      (self.center_x - 250, 600), "Easy")
        self.buttons['Medium'] = Button(pygame, res, surface,
                                        (self.center_x + 000, 600), "Medium")
        self.buttons['Hard'] = Button(pygame, res, surface,
                                      (self.center_x + 250, 600), "Hard")

        self.buttons['Back'] = Button(pygame, res, surface,
                                      (self.center_x, 700), "Back")
Ejemplo n.º 7
0
    def _build_gui(self):
        """Initializing wx objects that make up this conversion panel and their layout within.

        :return: None
        """
        self.SetBackgroundColour(UIStyle.conversion_background_color)

        # Create the wx controls for this conversion panel.
        self.convert_button = Button(self,
                                     label="Convert to LDraw",
                                     size=UIStyle.conversion_big_button_size)
        self.convert_button.SetBackgroundColour(UIStyle.button_background)
        self.convert_button.SetForegroundColour(UIStyle.button_text)
        self.pause_button = Button(self,
                                   label="Pause",
                                   size=UIStyle.conversion_big_button_size)
        self.pause_button.SetBackgroundColour(UIStyle.button_background)
        self.pause_button.SetForegroundColour(UIStyle.button_text)
        self.cancel_button = Button(self,
                                    label="Cancel",
                                    size=UIStyle.conversion_big_button_size)
        self.cancel_button.SetBackgroundColour(UIStyle.button_background)
        self.cancel_button.SetForegroundColour(UIStyle.button_text)
        self.save_button = Button(self,
                                  label="Save Conversion",
                                  size=UIStyle.conversion_big_button_size)
        self.save_button.SetBackgroundColour(UIStyle.button_background)
        self.save_button.SetForegroundColour(UIStyle.button_text)

        # Create the layout.
        horizontal_layout = wx.BoxSizer(wx.HORIZONTAL)
        horizontal_layout.Add(self.save_button, 0, wx.ALIGN_CENTER_HORIZONTAL)
        horizontal_layout.AddSpacer(5)
        horizontal_layout.Add(self.cancel_button, 0,
                              wx.ALIGN_CENTER_HORIZONTAL)
        horizontal_layout.AddSpacer(5)
        horizontal_layout.Add(self.pause_button, 0, wx.ALIGN_CENTER_HORIZONTAL)
        horizontal_layout.AddSpacer(5)
        horizontal_layout.Add(self.convert_button, 0,
                              wx.ALIGN_CENTER_HORIZONTAL)

        vertical_layout = wx.BoxSizer(wx.VERTICAL)
        vertical_layout.Add(horizontal_layout, 0, wx.ALIGN_CENTER)

        self.SetSizer(vertical_layout)

        # Bind the events for each wx control.
        self.Bind(wx.EVT_BUTTON, self.convert, self.convert_button)
        self.Bind(wx.EVT_BUTTON, self.pause_resume, self.pause_button)
        self.Bind(wx.EVT_BUTTON, self.cancel, self.cancel_button)
        self.Bind(wx.EVT_BUTTON, self.save, self.save_button)
Ejemplo n.º 8
0
    def _build_gui(self):
        """Create the necessary wx objects for the functional purposes of this output
        log panel.

        :return: None
        """
        # Build the wx control objects.
        self.SetBackgroundColour(UIStyle.log_background_color)
        style = wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL | wx.TE_RICH

        self.save_log_button = Button(self,
                                      label="Save Log",
                                      size=UIStyle.log_big_button)
        self.save_log_button.SetBackgroundColour(UIStyle.button_background)
        self.save_log_button.SetForegroundColour(UIStyle.button_text)

        # Set the log control output size.
        self.log_text_ctrl = rt.RichTextCtrl(self,
                                             size=UIStyle.log_output_size,
                                             style=style)
        self.log_text_ctrl.SetBackgroundColour(
            wx.Colour(UIStyle.log_text_background_color))

        self.Bind(wx.EVT_BUTTON, self.save_log, self.save_log_button)
        self._build_layout()
Ejemplo n.º 9
0
 def __init__(self, title, size, color, buttons, ui_group):
     BaseSprite.__init__(self, Menu.IMAGE, ui_group)
     self.buttons = [
         Button(b['action'], b['text'], b['size'], b['color'], _BTN_IMAGES,
                ui_group) for b in buttons
     ]
     self._make(title, size, color)
Ejemplo n.º 10
0
 def __init__(self, runtime, text, buttons, width, height):
     self._runtime = runtime
     self.shadow_padding = int(
         self._runtime.config.values[CONFIG_POPUP_SHADOW_PADDING])
     self.background_color = (
         int(self._runtime.config.values[CONFIG_POPUP_BACKGROUND_COLOR_R]),
         int(self._runtime.config.values[CONFIG_POPUP_BACKGROUND_COLOR_G]),
         int(self._runtime.config.values[CONFIG_POPUP_BACKGROUND_COLOR_B]))
     self.border_color = (
         int(self._runtime.config.values[CONFIG_POPUP_BORDER_COLOR_R]),
         int(self._runtime.config.values[CONFIG_POPUP_BORDER_COLOR_G]),
         int(self._runtime.config.values[CONFIG_POPUP_BORDER_COLOR_B]))
     self.shadow_color = (
         int(self._runtime.config.values[CONFIG_POPUP_SHADOW_COLOR_R]),
         int(self._runtime.config.values[CONFIG_POPUP_SHADOW_COLOR_G]),
         int(self._runtime.config.values[CONFIG_POPUP_SHADOW_COLOR_B]))
     self.text_object = self._runtime.config.popup_font.render(
         text, False, self._runtime.config.popup_font_color)
     self.width = width
     self.height = height
     self.center_x = self._runtime.width / 2
     self.center_y = self._runtime.height / 2
     self.x = int(self.center_x - self.width / 2)
     self.y = int(self.center_y - self.height / 2)
     self.buttons = list()
     self.button_width_total = -(int(
         self._runtime.config.values[CONFIG_BUTTON_PADDING]))
     self.button_count = 0
     if buttons is not None:
         for button_data in buttons:
             button = Button(self._runtime, button_data[0], button_data[1])
             self.buttons.append(button)
             self.button_width_total += button.width + int(
                 self._runtime.config.values[CONFIG_BUTTON_PADDING])
             self.button_count += 1
Ejemplo n.º 11
0
 def _create_buttons(self):
     size = pg.Vector2(x=7 * s.TILESIZE, y=2 * s.TILESIZE)
     return [
         Button(size=size,
                pos=pg.Vector2(s.TILESIZE, s.TILESIZE),
                text='New',
                on_click=CustomEvents.START_GAME,
                text_cfg=self.text_buttons_cfg,
                parent_transform=self.pos,
                parent_surface=self.image),
         Button(size=size,
                pos=pg.Vector2(s.TILESIZE, s.TILESIZE * 2 + size.y),
                text='Quit',
                on_click=pg.QUIT,
                text_cfg=self.text_buttons_cfg,
                parent_transform=self.pos,
                parent_surface=self.image)
     ]
Ejemplo n.º 12
0
    def __init__(self, pygame, res, surface, size):
        Screen.__init__(self, pygame, res, surface, size)

        self.texts['GameTitleShadow1'] = Text(pygame, res, surface,
                                              (self.center_x + 9, 100 + 9),
                                              'Coin Fall', res.game_title_font,
                                              res.BLACK)

        self.texts['GameTitleShadow2'] = Text(pygame, res, surface,
                                              (self.center_x + 6, 100 + 6),
                                              'Coin Fall', res.game_title_font,
                                              res.BLACK)

        self.texts['GameTitleShadow3'] = Text(pygame, res, surface,
                                              (self.center_x + 3, 100 + 3),
                                              'Coin Fall', res.game_title_font,
                                              res.BLACK)

        self.texts['GameTitle'] = Text(pygame, res, surface,
                                       (self.center_x, 100), 'Coin Fall',
                                       res.game_title_font,
                                       res.game_title_text_color)

        self.texts['Body1'] = Text(pygame, res, surface, (self.center_x, 190),
                                   'Open-source coin collection game',
                                   res.body_font, res.body_text_color)

        self.texts['Body2'] = Text(pygame, res, surface, (self.center_x, 220),
                                   'Made with Python and Pygame',
                                   res.body_font, res.body_text_color)

        self.buttons['Start'] = Button(pygame, res, surface,
                                       (self.center_x, 380), "Start")
        self.buttons['Tutorial'] = Button(pygame, res, surface,
                                          (self.center_x, 460), "Tutorial")
        self.buttons['Settings'] = Button(pygame, res, surface,
                                          (self.center_x, 540), "Settings")
        self.buttons['Credits'] = Button(pygame, res, surface,
                                         (self.center_x, 620), "Credits")
        self.buttons['Exit'] = Button(pygame, res, surface,
                                      (self.center_x, 700), "Exit")
Ejemplo n.º 13
0
    def __init__(self, pygame, res, surface, size, game_manager):
        Screen.__init__(self, pygame, res, surface, size)
        self.game_manager = game_manager

        self.texts['Heading1'] = Text(pygame, res, surface,
                                      (self.center_x + 3, 70 + 3), 'Game Over',
                                      res.heading1_font, res.BLACK)

        self.texts['Heading2'] = Text(pygame, res, surface,
                                      (self.center_x, 70), 'Game Over',
                                      res.heading1_font,
                                      res.game_title_text_color)

        self.texts['Body'] = Text(pygame, res, surface, (self.center_x, 130),
                                  'Game score and performance', res.body_font,
                                  res.body_text_color)

        self.buttons['Restart'] = Button(pygame, res, surface,
                                         (self.center_x, 290), "Restart")
        self.buttons['Back'] = Button(pygame, res, surface,
                                      (self.center_x, 700), "Back")
Ejemplo n.º 14
0
    def __init__(self, pygame, res, surface, size, game_manager):
        Screen.__init__(self, pygame, res, surface, size)
        self.highscore_manager = game_manager.highscore_manager

        self.texts['Heading1'] = Text(pygame, res, surface,
                                      (self.center_x + 3, 70 + 3), 'Settings',
                                      res.heading1_font, res.BLACK)

        self.texts['Heading2'] = Text(pygame, res, surface,
                                      (self.center_x, 70), 'Settings',
                                      res.heading1_font,
                                      res.game_title_text_color)

        self.texts['Body'] = Text(pygame, res, surface, (self.center_x, 130),
                                  'Edit game settings here', res.body_font,
                                  res.body_text_color)

        self.buttons['Reset'] = Button(pygame, res, surface,
                                       (self.center_x, 380), "Reset")

        self.buttons['Back'] = Button(pygame, res, surface,
                                      (self.center_x, 700), "Back")
Ejemplo n.º 15
0
 def __init__(self, pygame, res, surface):
     Screen.__init__(self, pygame, res, surface)
     self.buttons['Vineet'] = Button(
         pygame, res, surface, [20, 150, 300, 50], "Vineet")
     self.buttons['Amrit'] = Button(
         pygame, res, surface, [20, 220, 300, 50], "Amrit")
     self.buttons['Venturillo'] = Button(
         pygame, res, surface, [20, 290, 300, 50], "Venturillo")
     self.buttons['Divyang'] = Button(
         pygame, res, surface, [20, 360, 300, 50], "Divyang")
     self.buttons['Azmal'] = Button(
         pygame, res, surface, [20, 430, 300, 50], "Azmal")
     self.buttons['Abhinandan'] = Button(
         pygame, res, surface, [20, 500, 300, 50], "Abhinandan")
     self.buttons['Back'] = Button(
         pygame, res, surface, [20, 640, 300, 50], "Back")
Ejemplo n.º 16
0
    def __init__(self, pygame, res, surface, size):
        Screen.__init__(self, pygame, res, surface, size)

        self.texts['Heading1'] = Text(pygame, res, surface,
                                      (self.center_x + 3, 70 + 3), 'Tutorial',
                                      res.heading1_font, res.BLACK)

        self.texts['Heading2'] = Text(pygame, res, surface,
                                      (self.center_x, 70), 'Tutorial',
                                      res.heading1_font,
                                      res.game_title_text_color)

        self.texts['Body'] = Text(pygame, res, surface, (self.center_x, 130),
                                  'How to play the game', res.body_font,
                                  res.body_text_color)

        self.buttons['Back'] = Button(pygame, res, surface,
                                      (self.center_x, 700), "Back")
Ejemplo n.º 17
0
 def __init__(self, pygame, res, surface):
     Screen.__init__(self, pygame, res, surface)
     self.font = pygame.font.SysFont('cambria', 60)
     self.font2 = pygame.font.SysFont('cambria', 30)
     self.buttons['Vineet'] = Button(pygame, res, surface,
                                     [20, 150, 300, 50], "Vineet")
     self.buttons['Amrit'] = Button(pygame, res, surface,
                                    [20, 220, 300, 50], "Amrit")
     self.buttons['Venturillo'] = Button(pygame, res, surface,
                                         [20, 290, 300, 50], "Venturillo")
     self.buttons['Divyang'] = Button(pygame, res, surface,
                                      [20, 360, 300, 50], "Divyang")
     self.buttons['Azmal'] = Button(pygame, res, surface,
                                    [20, 430, 300, 50], "Azmal")
     self.buttons['Abhinandan'] = Button(pygame, res, surface,
                                         [20, 500, 300, 50], "Abhinandan")
     self.buttons['Gitter'] = Button(pygame, res, surface,
                                     [20, 570, 300, 50], "Gitter")
     self.buttons['Back'] = Button(pygame, res, surface, [20, 640, 300, 50],
                                   "Back")
Ejemplo n.º 18
0
    def __init__(self, pygame, res, surface, game_manager):
        Screen.__init__(self, pygame, res, surface)
        self.game_manager = game_manager

        self.buttons['Classic'] = Button(pygame, res, surface,
                                         [20, 170, 210, 50], "Classic")
        self.buttons['Infinite'] = Button(pygame, res, surface,
                                          [20, 240, 210, 50], "Infinite")
        self.buttons['1v1'] = Button(pygame, res, surface, [20, 310, 210, 50],
                                     "1 vs 1")

        self.buttons['Easy'] = Button(pygame, res, surface, [20, 520, 180, 50],
                                      "Easy")
        self.buttons['Medium'] = Button(pygame, res, surface,
                                        [240, 520, 180, 50], "Medium")
        self.buttons['Hard'] = Button(pygame, res, surface,
                                      [460, 520, 180, 50], "Hard")

        self.buttons['Back'] = Button(pygame, res, surface, [20, 680, 300, 50],
                                      "Back")
Ejemplo n.º 19
0
    def __init__(self, pygame, res, surface, size, game_manager):
        Screen.__init__(self, pygame, res, surface, size)

        self.game_manager = game_manager
        self.params_list = Gameplay_Parameters().params_list

        self.texts['Heading1'] = Text(pygame, res, surface,
                                      (self.center_x + 3, 70 + 3),
                                      'Introduction', res.heading1_font,
                                      res.BLACK)

        self.texts['Heading2'] = Text(pygame, res, surface,
                                      (self.center_x, 70), 'Introduction',
                                      res.heading1_font,
                                      res.game_title_text_color)

        self.texts['Body'] = Text(pygame, res, surface, (self.center_x, 130),
                                  'How to play this game mode', res.body_font,
                                  res.body_text_color)

        self.buttons_classic = {}
        self.buttons_others = {}

        self.buttons_classic['Easy'] = Button(pygame, res, surface,
                                              (self.center_x - 250, 620),
                                              "Easy")

        self.buttons_classic['Medium'] = Button(pygame, res, surface,
                                                (self.center_x + 000, 620),
                                                "Medium")

        self.buttons_classic['Hard'] = Button(pygame, res, surface,
                                              (self.center_x + 250, 620),
                                              "Hard")

        self.buttons_others['Start'] = Button(pygame, res, surface,
                                              (self.center_x, 620), "Start")

        self.buttons_classic['Back'] = Button(pygame, res, surface,
                                              (self.center_x, 700), "Back")

        self.buttons_others['Back'] = Button(pygame, res, surface,
                                             (self.center_x, 700), "Back")
Ejemplo n.º 20
0
 def __init__(self, pygame, res, surface):
     Screen.__init__(self, pygame, res, surface)
     self.font = pygame.font.SysFont('cambria', 60)
     self.font2 = pygame.font.SysFont('cambria', 30)
     self.buttons['Back'] =  Button(pygame, res, surface, [20, 360, 300, 50], "Back")
Ejemplo n.º 21
0
    def _build_gui(self):
        """Initializing input, output, process control, and log panel elements
        :return:
        """
        self.SetBackgroundColour(UIStyle.metadata_background_color)

        # Input
        path_name_static_text = wx.StaticText(
            self,
            label="Step 1: Choose Input STL File",
            size=UIStyle.metadata_label_size,
            style=wx.ALIGN_RIGHT)
        path_name_static_text.SetForegroundColour(UIStyle.metadata_label_color)
        # Stl input.
        self.stl_path_input = wx.TextCtrl(self, size=UIStyle.metadata_text_ctrl_size)
        self.stl_path_input.SetMaxLength(self.max_path_length)
        self.stl_path_input.SetBackgroundColour(UIStyle.metadata_input_valid_background)
        self.stl_path_input.SetForegroundColour(UIStyle.metadata_input_text_color)

        self.browse_stl_button = Button(self, label="Browse Input",
                                           size=UIStyle.metadata_big_button)
        self.browse_stl_button.SetForegroundColour(UIStyle.button_text)
        self.browse_stl_button.SetBackgroundColour(UIStyle.button_background)

        # Help / About.
        self.help_button = Button(self, label="?",
                                     size=UIStyle.metadata_small_button_size)
        self.help_button.SetForegroundColour(UIStyle.button_text)
        self.help_button.SetBackgroundColour(UIStyle.button_background)
        self.about_button = Button(self, label="i",
                                      size=UIStyle.metadata_small_button_size)
        self.about_button.SetForegroundColour(UIStyle.button_text)
        self.about_button.SetBackgroundColour(UIStyle.button_background)

        # Output path selection.
        path_part_static_text = wx.StaticText(self, label="Step 2: Choose Output Name",
                                              size=UIStyle.metadata_label_size,
                                              style=wx.ALIGN_RIGHT)
        path_part_static_text.SetForegroundColour(UIStyle.metadata_label_color)
        self.ldraw_name_input = wx.TextCtrl(self, size=UIStyle.metadata_text_ctrl_size,
                                            style= wx.TE_READONLY)
        self.ldraw_name_input.SetMaxLength(self.max_path_length)
        self.ldraw_name_input.SetValue("Browse output -->")
        self.ldraw_name_input.SetForegroundColour(UIStyle.metadata_input_text_color)
        self.ldraw_name_input.SetBackgroundColour(UIStyle.metadata_input_valid_background)

        self.browse_output_button = Button(self, label="Browse Output",
                                              size=UIStyle.metadata_big_button)
        self.browse_output_button.SetForegroundColour(UIStyle.button_text)
        self.browse_output_button.SetBackgroundColour(UIStyle.button_background)

        # Author
        author_static_text = wx.StaticText(self, label="Optional: Set Author",
                                           size=UIStyle.metadata_label_size, style=wx.ALIGN_RIGHT)
        author_static_text.SetForegroundColour(UIStyle.metadata_label_color)
        self.author_input = wx.TextCtrl(self, size=UIStyle.metadata_text_ctrl_size)
        self.author_input.SetForegroundColour(UIStyle.metadata_input_text_color)
        self.author_input.SetBackgroundColour(UIStyle.metadata_input_valid_background)
        self.author_input.SetMaxLength(self.max_path_length)

        # License information.
        license_static_text = wx.StaticText(self, label="Optional: Set License",
                                            size=UIStyle.metadata_label_size, style=wx.ALIGN_RIGHT)
        license_static_text.SetForegroundColour(UIStyle.metadata_label_color)
        self.license_input = wx.TextCtrl(self, size=UIStyle.metadata_text_ctrl_size)
        self.license_input.SetForegroundColour(UIStyle.metadata_input_text_color)
        self.license_input.SetBackgroundColour(UIStyle.metadata_input_valid_background)
        self.license_input.SetMaxLength(self.max_path_length)

        # Create the layout.
        horizontal_input = wx.BoxSizer(wx.HORIZONTAL)
        horizontal_output = wx.BoxSizer(wx.HORIZONTAL)
        horizontal_author = wx.BoxSizer(wx.HORIZONTAL)
        horizontal_license = wx.BoxSizer(wx.HORIZONTAL)
        horizontal_input.Add(path_name_static_text, 0, wx.ALIGN_CENTER)
        horizontal_input.AddSpacer(5)

        horizontal_input.Add(self.stl_path_input, 0, wx.ALIGN_CENTER)

        horizontal_input.AddSpacer(5)
        horizontal_input.Add(self.browse_stl_button, 0, wx.ALIGN_CENTER)
        horizontal_input.AddSpacer(5)
        horizontal_input.Add(self.help_button, 0, wx.ALIGN_CENTER)
        horizontal_input.AddSpacer(5)
        horizontal_input.Add(self.about_button, 0, wx.ALIGN_CENTER)

        horizontal_output.Add(path_part_static_text, 0, wx.ALIGN_LEFT)
        horizontal_output.AddSpacer(5)

        horizontal_output.Add(self.ldraw_name_input, 0, wx.ALIGN_LEFT)
        horizontal_output.AddSpacer(5)
        horizontal_output.Add(self.browse_output_button, 0, wx.ALIGN_LEFT)

        horizontal_author.Add(author_static_text, 0, wx.ALIGN_LEFT)
        horizontal_author.AddSpacer(5)
        horizontal_author.Add(self.author_input, 0, wx.ALIGN_LEFT)

        horizontal_license.Add(license_static_text, 0, wx.ALIGN_LEFT)
        horizontal_license.AddSpacer(5)
        horizontal_license.Add(self.license_input, 0, wx.ALIGN_LEFT)

        vertical_layout = wx.BoxSizer(wx.VERTICAL)
        vertical_layout.Add(horizontal_input, 0, wx.ALIGN_LEFT)
        vertical_layout.Add(horizontal_output, 0, wx.ALIGN_LEFT)
        vertical_layout.Add(horizontal_author, 0, wx.ALIGN_LEFT)
        vertical_layout.Add(horizontal_license, 0, wx.ALIGN_LEFT)

        horizontal_split = wx.BoxSizer(wx.HORIZONTAL)
        horizontal_split.AddSpacer(100)
        horizontal_split.Add(vertical_layout, 0, wx.ALIGN_LEFT)

        self.SetSizer(horizontal_split)

        # Fill in default fields
        self.reset_author()
        self.reset_license()

        # Register events.
        self.Bind(wx.EVT_BUTTON, self.about, self.about_button)
        self.Bind(wx.EVT_BUTTON, self.browse_output, self.browse_output_button)
        self.Bind(wx.EVT_BUTTON, self.help, self.help_button)
        self.Bind(wx.EVT_BUTTON, self.browse_input, self.browse_stl_button)

        # Bind input field change events
        self.stl_path_input.Bind(wx.EVT_KILL_FOCUS, self.text_ctrl_input_on_kill_focus)
        self.stl_path_input.Bind(wx.EVT_SET_FOCUS, self.text_ctrl_input_on_gain_focus)
        self.ldraw_name_input.Bind(wx.EVT_KILL_FOCUS, self.text_ctrl_output_on_kill_focus)
        self.ldraw_name_input.Bind(wx.EVT_SET_FOCUS, self.text_ctrl_placeholder_on_gain_focus)
        self.author_input.Bind(wx.EVT_KILL_FOCUS, self.text_ctrl_author_on_kill_focus)
        self.license_input.Bind(wx.EVT_KILL_FOCUS, self.text_ctrl_license_on_kill_focus)
Ejemplo n.º 22
0
    def _build_gui(self):
        """Initializing wx objects that make up this OpenGL panel and their layout within.

        :return: None
        """
        # Create the controls.
        self.cb_wire_frame = wx.CheckBox(self, label=" Wireframe")
        self.cb_wire_frame.SetForegroundColour(UIStyle.opengl_label_color)

        self.zoom_static_text_ctrl = wx.StaticText(self, size=(150, 30))
        self.zoom_static_text_ctrl.SetLabelText("Camera Distance to Origin: ")
        self.zoom_static_text_ctrl.SetForegroundColour(
            UIStyle.opengl_label_color)

        self.scale_static_text = wx.StaticText(self,
                                               label="Scale:",
                                               size=(50, 20))
        self.scale_static_text.SetForegroundColour(
            UIStyle.metadata_label_color)

        self.scale_up_button = Button(self, label="+", size=(23, 23))

        self.scale_down_button = Button(self, label="-", size=(23, 23))

        self.scale_input = wx.lib.masked.NumCtrl(self,
                                                 value=1.0,
                                                 size=(100, 20),
                                                 integerWidth=10,
                                                 fractionWidth=10,
                                                 min=0.0)
        self.scale_input.SetBackgroundColour(UIStyle.opengl_input_background)
        self.scale_input.SetForegroundColour(UIStyle.opengl_input_foreground)

        self.cycle_preview_button = Button(self,
                                           label="Preview LDraw Model",
                                           size=(150, 30))
        self.cycle_preview_button.Disable()

        self.camera_rotation_static_text_ctrl = wx.StaticText(self,
                                                              size=(270, 20))
        self.camera_rotation_static_text_ctrl.SetLabelText("Model Rotation: ")
        self.camera_rotation_static_text_ctrl.SetForegroundColour(
            UIStyle.opengl_label_color)

        self.camera_position_static_text_ctrl = wx.StaticText(self,
                                                              size=(270, 20))
        self.camera_position_static_text_ctrl.SetLabelText("Camera Position: ")
        self.camera_position_static_text_ctrl.SetForegroundColour(
            UIStyle.opengl_label_color)

        self.help_rotate_static_text_ctrl = wx.StaticText(self, size=(270, 50))
        self.help_rotate_static_text_ctrl.SetLabelText(
            "Hold left click while moving the mouse to rotate the camera.")
        self.help_rotate_static_text_ctrl.SetForegroundColour(
            UIStyle.opengl_label_color)
        self.help_rotate_static_text_ctrl.SetFont(
            wx.Font(12, wx.DECORATIVE, wx.ITALIC, wx.NORMAL))

        self.help_zoom_static_text_ctrl = wx.StaticText(self, size=(270, 50))
        self.help_zoom_static_text_ctrl.SetLabelText(
            "Use the mouse wheel to zoom the camera from the origin.")
        self.help_zoom_static_text_ctrl.SetForegroundColour(
            UIStyle.opengl_label_color)
        self.help_zoom_static_text_ctrl.SetFont(
            wx.Font(12, wx.DECORATIVE, wx.ITALIC, wx.NORMAL))

        self.preview_render_context = wx.StaticText(self, size=(270, 20))
        self.preview_render_context.SetLabelText("Current Preview: ")
        self.preview_render_context.SetForegroundColour(
            UIStyle.opengl_label_color)

        self.opengl_canvas = OpenGLCanvas(self)
        show = glInitGl42VERSION()
        # Build the layout and show the controls if correct OpenGL version
        self._build_layout(show)

        # Bind events to functions.
        self.Bind(wx.EVT_CHECKBOX, self.on_wire_frame_pressed,
                  self.cb_wire_frame)
        self.Bind(wx.EVT_BUTTON, self.on_cycle_preview_pressed,
                  self.cycle_preview_button)
        self.Bind(wx.EVT_BUTTON, self.on_scale_up, self.scale_up_button)
        self.Bind(wx.EVT_BUTTON, self.on_scale_down, self.scale_down_button)

        self.scale_input.Bind(wx.lib.masked.EVT_NUM,
                              self.on_scale_value_changed)

        # Disable widgets until they are necessary from application state context.
        self.set_widget_rendering_contexts(False)
Ejemplo n.º 23
0
 def __init__(self, pygame, res, surface):
     Screen.__init__(self, pygame, res, surface)
     self.buttons['Back'] = Button(
         pygame, res, surface, [20, 360, 300, 50], "Back")
Ejemplo n.º 24
0
 def __init__(self, screen_controller):
     super(self.__class__, self).__init__(screen_controller)
     self.window = Window(self._screen_controller.runtime,
                          TEXT_GAME_SELECTION, 600, 400, 2)
     self.window.add_display_element(
         Button(screen_controller.runtime, GAME_BUTTON + str('xxx'), 'XXX'))