Example #1
0
    def add_header(self, sizer):
        """Build and add the header to the sizer.

        @param sizer:   The sizer element to pack the header into.
        @type sizer:    wx.Sizer instance
        """

        # Create a horizontal layout.
        sub_sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Left spacing.
        sub_sizer.AddStretchSpacer(3)

        # Add the BMRB logo (left side).
        logo = wx.StaticBitmap(self.main_panel, -1, bitmap_setup(IMAGE_PATH+"bmrb_100x100.png"))
        sub_sizer.Add(logo, 0, wx.TOP|wx.ALIGN_CENTER_HORIZONTAL, 0)

        # Spacing.
        sub_sizer.AddStretchSpacer()

        # The text sizer.
        text_sizer = wx.BoxSizer(wx.VERTICAL)

        # The title.
        text = wx.StaticText(self.main_panel, -1, 'Data export for BMRB deposition', style=wx.ALIGN_LEFT)
        text.SetFont(font.title)
        text_sizer.Add(text, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)

        # Spacing.
        text_sizer.AddSpacer(15)

        # The text.
        main_text = 'This wizard will help in executing all of the relevant user functions required to convert the contents of the selected data pipe to the NMR-STAR format for deposition within the BioMagResBank.  Note that this is currently only for the deposition of model-free analysis results or simple NMR relaxation data.'
        text = wx.StaticText(self.main_panel, -1, main_text, style=wx.ALIGN_LEFT)
        text.Wrap(600)
        text.SetFont(font.normal)
        text_sizer.Add(text, 0, 0, 0)

        # Add the text sizer.
        sub_sizer.Add(text_sizer, 0, 0, 0)

        # Spacing.
        sub_sizer.AddStretchSpacer()

        # Add the BMRB logo (right side).
        logo = wx.StaticBitmap(self.main_panel, -1, bitmap_setup(IMAGE_PATH+"bmrb_100x100.png"))
        sub_sizer.Add(logo, 0, wx.TOP|wx.ALIGN_CENTER_HORIZONTAL, 0)

        # Right spacing.
        sub_sizer.AddStretchSpacer(3)

        # Add the sizer.
        sizer.Add(sub_sizer, 0, wx.ALL|wx.EXPAND, 0)

        # A line with spacing.
        sizer.AddSpacer(10)
        sizer.Add(wx.StaticLine(self.main_panel, -1), 0, wx.EXPAND|wx.ALL, 0)
        sizer.AddSpacer(10)
Example #2
0
    def build_left_box(self):
        """Construct the left hand box to pack into the automatic Rx analysis frame.

        @return:    The left hand box element containing the bitmap.
        @rtype:     wx.BoxSizer instance
        """

        # Use a vertical packing of elements.
        box = wx.BoxSizer(wx.VERTICAL)

        # Convert the bitmap names to a list.
        if not isinstance(self.bitmap, list):
            bitmaps = [self.bitmap]
        else:
            bitmaps = self.bitmap

        # Add the bitmaps.
        for i in range(len(bitmaps)):
            # The bitmap.
            bitmap = wx.StaticBitmap(self, -1, bitmap_setup(bitmaps[i]))

            # Add it.
            box.Add(bitmap, 0, wx.ADJUST_MINSIZE, 10)

        # Return the box.
        return box
Example #3
0
    def build_left_box(self):
        """Construct the left hand box to pack into the automatic Rx analysis frame.

        @return:    The left hand box element containing the bitmap.
        @rtype:     wx.BoxSizer instance
        """

        # Use a vertical packing of elements.
        box = wx.BoxSizer(wx.VERTICAL)

        # Convert the bitmap names to a list.
        if not isinstance(self.bitmap, list):
            bitmaps = [self.bitmap]
        else:
            bitmaps = self.bitmap

        # Add the bitmaps.
        for i in range(len(bitmaps)):
            # The bitmap.
            bitmap = wx.StaticBitmap(self, -1, bitmap_setup(bitmaps[i]))

            # Add it.
            box.Add(bitmap, 0, wx.ADJUST_MINSIZE, 10)

        # Return the box.
        return box
Example #4
0
    def build_left_box(self):
        """Construct the left hand box to pack into the main model-free box.

        @return:    The left hand box element containing the bitmap and about button to pack into the main model-free box.
        @rtype:     wx.BoxSizer instance
        """

        # Build the left hand box.
        left_box = wx.BoxSizer(wx.VERTICAL)

        # The images.
        bitmaps = [
            ANALYSIS_IMAGE_PATH + "model_free" + sep +
            "model_free_200x200.png", IMAGE_PATH + 'modelfree.png'
        ]

        # Add the model-free bitmap picture.
        for i in range(len(bitmaps)):
            # The bitmap.
            bitmap = wx.StaticBitmap(self, -1, bitmap_setup(bitmaps[i]))

            # Add it.
            left_box.Add(bitmap, 0, wx.ALL, 0)

        # A spacer.
        left_box.AddStretchSpacer()

        # A button sizer, with some initial spacing.
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)

        # An about button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(
            self, -1, None, "About")
        button.SetBitmapLabel(
            wx.Bitmap(fetch_icon('oxygen.actions.help-about', "22x22"),
                      wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetToolTip(
            wx.ToolTip("Information about this automatic analysis"))

        # Bind the click.
        self.Bind(wx.EVT_BUTTON, self._about, button)

        # A cursor for the button.
        if dep_check.wx_classic:
            cursor = wx.StockCursor(wx.CURSOR_QUESTION_ARROW)
        else:
            cursor = wx.Cursor(wx.CURSOR_QUESTION_ARROW)
        button.SetCursor(cursor)

        # Pack the button.
        button_sizer.Add(button, 0, 0, 0)
        left_box.Add(button_sizer, 0, wx.ALL, 0)

        # Return the packed box.
        return left_box
Example #5
0
    def add_logo(self, box):
        """Add the logo to the sizer.

        @param box:     The sizer element to pack the logo into.
        @type box:      wx.Sizer instance
        """

        # The pipe logo.
        logo = wx.StaticBitmap(self.main_panel, -1, bitmap_setup(WIZARD_IMAGE_PATH+'pipe_200x90.png'))

        # Pack the logo.
        box.Add(logo, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
Example #6
0
    def add_logo(self, box):
        """Add the logo to the sizer.

        @param box:     The sizer element to pack the logo into.
        @type box:      wx.Sizer instance
        """

        # The pipe logo.
        logo = wx.StaticBitmap(self.main_panel, -1, bitmap_setup(WIZARD_IMAGE_PATH+'pipe_200x90.png'))

        # Pack the logo.
        box.Add(logo, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
Example #7
0
    def header_spin(self):
        """Create the header for the spin container.

        @return:    The sizer containing the header.
        @rtype:     wx.Sizer instance
        """

        # A sizer for the header.
        sizer = wx.BoxSizer(wx.HORIZONTAL)

        # A sizer for the text component of the header.
        text_sizer = wx.BoxSizer(wx.VERTICAL)

        # The title
        title = self.create_title("Spin container")
        text_sizer.Add(title, 0, wx.LEFT, 0)

        # Spacer.
        text_sizer.AddSpacer(30)

        # The info grid.
        grid_sizer = wx.FlexGridSizer(6, 2, 5, 50)
        grid_sizer.Add(self.create_head_text("Molecule:"), 0, wx.ADJUST_MINSIZE, 0)
        grid_sizer.Add(self.create_head_text(self.mol_name), 0, wx.ADJUST_MINSIZE, 0)
        grid_sizer.Add(self.create_head_text("Residue number:"), 0, wx.ADJUST_MINSIZE, 0)
        grid_sizer.Add(self.create_head_text(self.res_num), 0, wx.ADJUST_MINSIZE, 0)
        grid_sizer.Add(self.create_head_text("Residue name:"), 0, wx.ADJUST_MINSIZE, 0)
        grid_sizer.Add(self.create_head_text(self.res_name), 0, wx.ADJUST_MINSIZE, 0)
        grid_sizer.Add(self.create_head_text("Spin number:"), 0, wx.ADJUST_MINSIZE, 0)
        grid_sizer.Add(self.create_head_text(self.spin_num), 0, wx.ADJUST_MINSIZE, 0)
        grid_sizer.Add(self.create_head_text("Spin name:"), 0, wx.ADJUST_MINSIZE, 0)
        grid_sizer.Add(self.create_head_text(self.spin_name), 0, wx.ADJUST_MINSIZE, 0)
        grid_sizer.Add(self.create_head_text("Spin ID string:"), 0, wx.ADJUST_MINSIZE, 0)
        grid_sizer.Add(self.create_head_text("'%s'" % self.spin_id), 0, wx.ADJUST_MINSIZE, 0)
        text_sizer.Add(grid_sizer, 0, wx.LEFT, 0)

        # Add the text sizer to the main header sizer.
        sizer.Add(text_sizer, 1, wx.ALL|wx.EXPAND, 0)

        # Stretch spacer.
        sizer.AddStretchSpacer()

        # The graphic.
        if self.select:
            path = WIZARD_IMAGE_PATH + 'spin.png'
        else:
            path = WIZARD_IMAGE_PATH + 'spin_grey.png'
        image = wx.StaticBitmap(self.parent, -1, bitmap_setup(path))
        sizer.Add(image, 0, wx.RIGHT, 0)

        # Return the sizer.
        return sizer
Example #8
0
    def add_artwork(self, sizer):
        """Add the artwork to the dialog.

        @param sizer:   A sizer object.
        @type sizer:    wx.Sizer instance
        """

        # Add the graphics.
        if self.image_path:
            self.image = wx.StaticBitmap(self, -1, bitmap_setup(self.image_path))
            sizer.Add(self.image, 0, wx.TOP|wx.ALIGN_CENTER_HORIZONTAL, 0)

        # A spacer.
        sizer.AddSpacer(self.art_spacing)
Example #9
0
    def add_artwork(self, sizer):
        """Add the artwork to the dialog.

        @param sizer:   A sizer object.
        @type sizer:    wx.Sizer instance
        """

        # Add the graphics.
        if self.image_path:
            self.image = wx.StaticBitmap(self, -1, bitmap_setup(self.image_path))
            sizer.Add(self.image, 0, wx.TOP|wx.ALIGN_CENTER_HORIZONTAL, 0)

        # A spacer.
        sizer.AddSpacer(self.art_spacing)
Example #10
0
    def add_relax_logo(self, sizer):
        """Add the relax logo to the sizer.

        @param sizer:   The sizer element to pack the relax logo into.
        @type sizer:    wx.Sizer instance
        """

        # The logo.
        logo = wx.StaticBitmap(self.main_panel, -1, bitmap_setup(IMAGE_PATH+'relax.gif'))

        # Add the relax logo.
        sizer.Add(logo, 0, wx.TOP|wx.ALIGN_CENTER_HORIZONTAL, 0)

        # Spacing.
        sizer.AddSpacer(self.spacer)
Example #11
0
    def add_relax_logo(self, sizer):
        """Add the relax logo to the sizer.

        @param sizer:   The sizer element to pack the relax logo into.
        @type sizer:    wx.Sizer instance
        """

        # The logo.
        logo = wx.StaticBitmap(self.main_panel, -1,
                               bitmap_setup(IMAGE_PATH + 'relax.gif'))

        # Add the relax logo.
        sizer.Add(logo, 0, wx.TOP | wx.ALIGN_CENTER_HORIZONTAL, 0)

        # Spacing.
        sizer.AddSpacer(self.spacer)
Example #12
0
    def build_left_box(self):
        """Construct the left hand box to pack into the main model-free box.

        @return:    The left hand box element containing the bitmap and about button to pack into the main model-free box.
        @rtype:     wx.BoxSizer instance
        """

        # Build the left hand box.
        left_box = wx.BoxSizer(wx.VERTICAL)

        # The images.
        bitmaps = [ANALYSIS_IMAGE_PATH+"model_free"+sep+"model_free_200x200.png",
                   IMAGE_PATH+'modelfree.png']

        # Add the model-free bitmap picture.
        for i in range(len(bitmaps)):
            # The bitmap.
            bitmap = wx.StaticBitmap(self, -1, bitmap_setup(bitmaps[i]))

            # Add it.
            left_box.Add(bitmap, 0, wx.ALL, 0)

        # A spacer.
        left_box.AddStretchSpacer()

        # A button sizer, with some initial spacing.
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)

        # An about button.
        button = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, "About")
        button.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.help-about', "22x22"), wx.BITMAP_TYPE_ANY))
        button.SetFont(font.normal)
        button.SetToolTipString("Information about this automatic analysis")

        # Bind the click.
        self.Bind(wx.EVT_BUTTON, self._about, button)

        # A cursor for the button.
        cursor = wx.StockCursor(wx.CURSOR_QUESTION_ARROW)
        button.SetCursor(cursor)

        # Pack the button.
        button_sizer.Add(button, 0, 0, 0)
        left_box.Add(button_sizer, 0, wx.ALL, 0)

        # Return the packed box.
        return left_box
Example #13
0
    def add_start_screen(self):
        """Create a start screen for the main window when no analyses exist."""

        # The sizer for the main GUI window.
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(sizer)

        # The relax icon.
        image = wx.StaticBitmap(self, -1, bitmap_setup(IMAGE_PATH+'ulysses_shadowless_400x168.png'))

        # Add the icon to the main spacer with spacing.
        sizer.AddStretchSpacer()
        sizer.Add(image, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
        sizer.AddStretchSpacer()

        # Re-perform the layout of the GUI elements, and refresh.
        self.Layout()
        self.Refresh()
Example #14
0
    def __init__(self, parent=None):
        """Set up the window."""

        # Execute the base __init__() method.
        wx.Dialog.__init__(self,
                           parent,
                           id=-1,
                           title="Free file format",
                           style=wx.DEFAULT_FRAME_STYLE)

        # The sizes.
        self._main_size = self.SIZE[0] - 2 * self.BORDER
        self._div_left = self._main_size / 2

        # Set up the window icon.
        self.SetIcons(Relax_icons())

        # The main sizer.
        self.main_sizer = self.build_frame()

        # The heading.
        text = wx.StaticText(self, -1, "Settings for the free file format")
        text.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.main_sizer.Add(text, 0, wx.ALIGN_CENTER_HORIZONTAL, 5)
        self.main_sizer.AddStretchSpacer()

        # The relax logo.
        bmp = wx.StaticBitmap(self, -1, bitmap_setup(IMAGE_PATH + 'relax.gif'))
        self.main_sizer.Add(bmp, 0, wx.ALIGN_CENTER_HORIZONTAL, 5)
        self.main_sizer.AddStretchSpacer()

        # The centre section.
        self.add_centre(self.main_sizer)

        # The bottom buttons.
        self.add_buttons(self.main_sizer)

        # Set the window size.
        self.SetSize(self.SIZE)
        self.SetMinSize(self.SIZE)

        # Centre the window.
        self.Center()
Example #15
0
    def add_artwork(self, sizer):
        """Add the artwork to the dialog.

        @param sizer:   A sizer object.
        @type sizer:    wx.Sizer instance
        """

        # Create a vertical box.
        sizer2 = wx.BoxSizer(wx.VERTICAL)

        # Add a spacer.
        sizer2.AddSpacer(30)

        # Add the graphics.
        self.image = wx.StaticBitmap(self, -1, bitmap_setup(self.image_path))
        sizer2.Add(self.image, 0, wx.TOP|wx.ALIGN_CENTER_HORIZONTAL, 0)

        # Nest the sizers.
        sizer.Add(sizer2)

        # A spacer.
        sizer.AddSpacer(self.art_spacing)
    def __init__(self, parent=None):
        """Set up the window."""

        # Execute the base __init__() method.
        wx.Dialog.__init__(self, parent, id=-1, title="Free file format", style=wx.DEFAULT_FRAME_STYLE)

        # The sizes.
        self._main_size = self.SIZE[0] - 2*self.BORDER
        self._div_left = self._main_size / 2

        # Set up the window icon.
        self.SetIcons(relax_icons)

        # The main sizer.
        self.main_sizer = self.build_frame()

        # The heading.
        text = wx.StaticText(self, -1, "Settings for the free file format")
        text.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.main_sizer.Add(text, 0, wx.ALIGN_CENTER_HORIZONTAL, 5)
        self.main_sizer.AddStretchSpacer()

        # The relax logo.
        bmp = wx.StaticBitmap(self, -1, bitmap_setup(IMAGE_PATH+'relax.gif'))
        self.main_sizer.Add(bmp, 0, wx.ALIGN_CENTER_HORIZONTAL, 5)
        self.main_sizer.AddStretchSpacer()

        # The centre section.
        self.add_centre(self.main_sizer)

        # The bottom buttons.
        self.add_buttons(self.main_sizer)

        # Set the window size.
        self.SetSize(self.SIZE)
        self.SetMinSize(self.SIZE)

        # Centre the window.
        self.Center()
Example #17
0
    def __init__(self,
                 msg,
                 parent=None,
                 title='',
                 size=(350, 125),
                 default=False):
        """A generic question box.

        @param msg:         The text message to display.
        @type msg:          str
        @keyword parent:    The parent wx object.
        @type parent:       wx.object instance
        @keyword title:     The window title.
        @type title:        str
        @keyword default:   If True, the default button will be 'yes', otherwise it will be 'no'.
        @type default:      bool
        @return:            The answer.
        @rtype:             bool
        """

        # Initialise the base class.
        wx.Dialog.__init__(self,
                           parent,
                           title=title,
                           size=size,
                           style=wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP)

        # Flag to indicate that a button was pressed.
        self.pressed = False

        # The default.
        if default:
            self.answer = wx.ID_YES
        else:
            self.answer = wx.ID_NO

        # Set up the window icon.
        self.SetIcons(relax_icons)

        # Centre the window.
        self.Centre()

        # A sizer for the dialog.
        main_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.SetSizer(main_sizer)

        # Build the central sizer, with borders.
        sizer = gui.misc.add_border(main_sizer,
                                    border=self.border,
                                    packing=wx.HORIZONTAL)

        # Add the graphic.
        bitmap = wx.StaticBitmap(
            self, -1,
            bitmap_setup(
                fetch_icon('oxygen.status.dialog-warning-relax-blue',
                           "48x48")))
        sizer.Add(bitmap)

        # Spacing.
        sizer.AddSpacer(self.spacer_main)

        # A vertical sizer for the right hand contents.
        sub_sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(sub_sizer, 1, wx.ALL | wx.EXPAND, 0)

        # Convert to a text element.
        text = wx.StaticText(self, -1, msg, style=wx.TE_MULTILINE)
        text.SetFont(font.normal)
        sub_sizer.Add(text, 1, wx.ALL | wx.EXPAND, 0)

        # A sizer for the buttons.
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        sub_sizer.Add(button_sizer, 0, wx.ALIGN_RIGHT, 0)

        # The yes button.
        button_yes = wx.lib.buttons.ThemedGenBitmapTextButton(
            self, -1, None, " Yes")
        button_yes.SetBitmapLabel(
            wx.Bitmap(fetch_icon('oxygen.actions.dialog-ok', "22x22"),
                      wx.BITMAP_TYPE_ANY))
        button_yes.SetFont(font.normal)
        button_yes.SetMinSize((self.width_button, self.height_button))
        button_sizer.Add(button_yes, 0,
                         wx.ADJUST_MINSIZE | wx.ALIGN_CENTER_VERTICAL, 0)
        self.Bind(wx.EVT_BUTTON, self.yes, button_yes)

        # Button spacing.
        button_sizer.AddSpacer(self.spacer_button)

        # The no button.
        button_no = wx.lib.buttons.ThemedGenBitmapTextButton(
            self, -1, None, " No")
        button_no.SetBitmapLabel(
            wx.Bitmap(fetch_icon('oxygen.actions.dialog-cancel', "22x22"),
                      wx.BITMAP_TYPE_ANY))
        button_no.SetFont(font.normal)
        button_no.SetMinSize((self.width_button, self.height_button))
        button_sizer.Add(button_no, 0,
                         wx.ADJUST_MINSIZE | wx.ALIGN_CENTER_VERTICAL, 0)
        self.Bind(wx.EVT_BUTTON, self.no, button_no)

        # Set the focus to the default button.
        if self.answer == wx.ID_YES:
            button_yes.SetFocus()
        else:
            button_no.SetFocus()

        # Bind some events.
        self.Bind(wx.EVT_CLOSE, self.handler_close)
Example #18
0
    def __init__(self, missing=[], parent=None):
        """Set up the dialog.

        @keyword missing:   The list of missing data types.
        @type missing:      list of str
        @keyword parent:    The parent wx element.
        @type parent:       wx object
        """

        # Initialise the base class.
        wx.Dialog.__init__(self,
                           parent,
                           title='Missing data',
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
                           | wx.STAY_ON_TOP)

        # Set up the window icon.
        self.SetIcons(relax_icons)

        # Set the initial size.
        self.SetSize((600, 400))

        # Centre the window.
        self.Centre()

        # A sizer for the dialog.
        main_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.SetSizer(main_sizer)

        # Build the central sizer, with borders.
        sizer = gui.misc.add_border(main_sizer,
                                    border=10,
                                    packing=wx.HORIZONTAL)

        # Add the graphic.
        bitmap = wx.StaticBitmap(
            self, -1,
            bitmap_setup(fetch_icon('oxygen.status.user-busy', "48x48")))
        sizer.Add(bitmap)

        # Spacing.
        sizer.AddSpacer(20)

        # A scrolled panel for the text.
        panel = wx.lib.scrolledpanel.ScrolledPanel(self, -1)
        panel.SetAutoLayout(1)
        panel.SetupScrolling()
        sizer.Add(panel, 1, wx.ALL | wx.EXPAND, 0)

        # A sizer for the panel.
        panel_sizer = wx.BoxSizer(wx.HORIZONTAL)
        panel.SetSizer(panel_sizer)

        # The message.
        msg = "The set up is incomplete.\n\n"
        if not len(missing):
            msg = msg + "Please check for missing data.\n"
        else:
            msg = msg + "Please check for the following missing information:\n"
        for data in missing:
            msg = msg + "    %s\n" % data

        # Convert to a text element.
        text = wx.StaticText(panel, -1, msg, style=wx.TE_MULTILINE)
        panel_sizer.Add(text)

        # Show the GUI element.
        if status.show_gui:
            self.ShowModal()

        # Otherwise throw the error out to stderr.
        else:
            sys.stderr.write("Missing data:  %s\n" % msg)
Example #19
0
    def __init__(self, missing=[], parent=None):
        """Set up the dialog.

        @keyword missing:   The list of missing data types.
        @type missing:      list of str
        @keyword parent:    The parent wx element.
        @type parent:       wx object
        """

        # Initialise the base class.
        wx.Dialog.__init__(self, parent, title='Missing data', style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.STAY_ON_TOP)

        # Set up the window icon.
        self.SetIcons(relax_icons)

        # Set the initial size.
        self.SetSize((600, 400))

        # Centre the window.
        self.Centre()

        # A sizer for the dialog.
        main_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.SetSizer(main_sizer)

        # Build the central sizer, with borders.
        sizer = gui.misc.add_border(main_sizer, border=10, packing=wx.HORIZONTAL)

        # Add the graphic.
        bitmap = wx.StaticBitmap(self, -1, bitmap_setup(fetch_icon('oxygen.status.user-busy', "48x48")))
        sizer.Add(bitmap)

        # Spacing.
        sizer.AddSpacer(20)

        # A scrolled panel for the text.
        panel = wx.lib.scrolledpanel.ScrolledPanel(self, -1)
        panel.SetAutoLayout(1)
        panel.SetupScrolling()
        sizer.Add(panel, 1, wx.ALL|wx.EXPAND, 0)

        # A sizer for the panel.
        panel_sizer = wx.BoxSizer(wx.HORIZONTAL)
        panel.SetSizer(panel_sizer)

        # The message.
        msg = "The set up is incomplete.\n\n"
        if not len(missing):
            msg = msg + "Please check for missing data.\n"
        else:
            msg = msg + "Please check for the following missing information:\n"
        for data in missing:
            msg = msg + "    %s\n" % data

        # Convert to a text element.
        text = wx.StaticText(panel, -1, msg, style=wx.TE_MULTILINE)
        panel_sizer.Add(text)

        # Show the GUI element.
        if status.show_gui:
            self.ShowModal()

        # Otherwise throw the error out to stderr.
        else:
            sys.stderr.write("Missing data:  %s\n" % msg)
Example #20
0
    def __init__(self, msg, parent=None, title='', size=(350, 125), default=False):
        """A generic question box.

        @param msg:         The text message to display.
        @type msg:          str
        @keyword parent:    The parent wx object.
        @type parent:       wx.object instance
        @keyword title:     The window title.
        @type title:        str
        @keyword default:   If True, the default button will be 'yes', otherwise it will be 'no'.
        @type default:      bool
        @return:            The answer.
        @rtype:             bool
        """

        # Initialise the base class.
        wx.Dialog.__init__(self, parent, title=title, size=size, style=wx.DEFAULT_DIALOG_STYLE|wx.STAY_ON_TOP)

        # Flag to indicate that a button was pressed.
        self.pressed = False

        # The default.
        if default:
            self.answer = wx.ID_YES
        else:
            self.answer = wx.ID_NO

        # Set up the window icon.
        self.SetIcons(relax_icons)

        # Centre the window.
        self.Centre()

        # A sizer for the dialog.
        main_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.SetSizer(main_sizer)

        # Build the central sizer, with borders.
        sizer = gui.misc.add_border(main_sizer, border=self.border, packing=wx.HORIZONTAL)

        # Add the graphic.
        bitmap = wx.StaticBitmap(self, -1, bitmap_setup(fetch_icon('oxygen.status.dialog-warning-relax-blue', "48x48")))
        sizer.Add(bitmap)

        # Spacing.
        sizer.AddSpacer(self.spacer_main)

        # A vertical sizer for the right hand contents.
        sub_sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(sub_sizer, 1, wx.ALL|wx.EXPAND, 0)

        # Convert to a text element.
        text = wx.StaticText(self, -1, msg, style=wx.TE_MULTILINE)
        text.SetFont(font.normal)
        sub_sizer.Add(text, 1, wx.ALL|wx.EXPAND, 0)

        # A sizer for the buttons.
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        sub_sizer.Add(button_sizer, 0, wx.ALIGN_RIGHT, 0)

        # The yes button.
        button_yes = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " Yes")
        button_yes.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.dialog-ok', "22x22"), wx.BITMAP_TYPE_ANY))
        button_yes.SetFont(font.normal)
        button_yes.SetMinSize((self.width_button, self.height_button))
        button_sizer.Add(button_yes, 0, wx.ADJUST_MINSIZE|wx.ALIGN_CENTER_VERTICAL, 0)
        self.Bind(wx.EVT_BUTTON, self.yes, button_yes)

        # Button spacing.
        button_sizer.AddSpacer(self.spacer_button)

        # The no button.
        button_no = wx.lib.buttons.ThemedGenBitmapTextButton(self, -1, None, " No")
        button_no.SetBitmapLabel(wx.Bitmap(fetch_icon('oxygen.actions.dialog-cancel', "22x22"), wx.BITMAP_TYPE_ANY))
        button_no.SetFont(font.normal)
        button_no.SetMinSize((self.width_button, self.height_button))
        button_sizer.Add(button_no, 0, wx.ADJUST_MINSIZE|wx.ALIGN_CENTER_VERTICAL, 0)
        self.Bind(wx.EVT_BUTTON, self.no, button_no)

        # Set the focus to the default button.
        if self.answer == wx.ID_YES:
            button_yes.SetFocus()
        else:
            button_no.SetFocus()

        # Bind some events.
        self.Bind(wx.EVT_CLOSE, self.handler_close)
Example #21
0
    def add_header(self, sizer):
        """Build and add the header to the sizer.

        @param sizer:   The sizer element to pack the header into.
        @type sizer:    wx.Sizer instance
        """

        # Create a horizontal layout.
        sub_sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Left spacing.
        sub_sizer.AddStretchSpacer(3)

        # Add the BMRB logo (left side).
        logo = wx.StaticBitmap(self.main_panel, -1,
                               bitmap_setup(IMAGE_PATH + "bmrb_100x100.png"))
        sub_sizer.Add(logo, 0, wx.TOP | wx.ALIGN_CENTER_HORIZONTAL, 0)

        # Spacing.
        sub_sizer.AddStretchSpacer()

        # The text sizer.
        text_sizer = wx.BoxSizer(wx.VERTICAL)

        # The title.
        text = wx.StaticText(self.main_panel,
                             -1,
                             'Data export for BMRB deposition',
                             style=wx.ALIGN_LEFT)
        text.SetFont(font.title)
        text_sizer.Add(text, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)

        # Spacing.
        text_sizer.AddSpacer(15)

        # The text.
        main_text = 'This wizard will help in executing all of the relevant user functions required to convert the contents of the selected data pipe to the NMR-STAR format for deposition within the BioMagResBank.  Note that this is currently only for the deposition of model-free analysis results or simple NMR relaxation data.'
        text = wx.StaticText(self.main_panel,
                             -1,
                             main_text,
                             style=wx.ALIGN_LEFT)
        text.Wrap(600)
        text.SetFont(font.normal)
        text_sizer.Add(text, 0, 0, 0)

        # Add the text sizer.
        sub_sizer.Add(text_sizer, 0, 0, 0)

        # Spacing.
        sub_sizer.AddStretchSpacer()

        # Add the BMRB logo (right side).
        logo = wx.StaticBitmap(self.main_panel, -1,
                               bitmap_setup(IMAGE_PATH + "bmrb_100x100.png"))
        sub_sizer.Add(logo, 0, wx.TOP | wx.ALIGN_CENTER_HORIZONTAL, 0)

        # Right spacing.
        sub_sizer.AddStretchSpacer(3)

        # Add the sizer.
        sizer.Add(sub_sizer, 0, wx.ALL | wx.EXPAND, 0)

        # A line with spacing.
        sizer.AddSpacer(10)
        sizer.Add(wx.StaticLine(self.main_panel, -1), 0, wx.EXPAND | wx.ALL, 0)
        sizer.AddSpacer(10)