Beispiel #1
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        default_colour = wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUBAR)
        self.SetBackgroundColour(default_colour)

        #self.SetBackgroundColour(wx.Colour(255,255,255))
        self.SetAutoLayout(1)

        # Fixed hyperlink items
        tooltip = wx.ToolTip(
            _("Automatically select largest disconnected region and create new surface"
              ))
        link_largest = hl.HyperLinkCtrl(self, -1, _("Select largest surface"))
        link_largest.SetUnderlines(False, False, False)
        link_largest.SetColours("BLACK", "BLACK", "BLACK")
        link_largest.SetToolTip(tooltip)
        link_largest.AutoBrowse(False)
        link_largest.UpdateLink()
        link_largest.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkLargest)

        tooltip = wx.ToolTip(
            _("Automatically select disconnected regions and create a new surface per region"
              ))
        link_split_all = hl.HyperLinkCtrl(self, -1,
                                          _("Split all disconnected surfaces"))
        link_split_all.SetUnderlines(False, False, False)
        link_split_all.SetColours("BLACK", "BLACK", "BLACK")
        link_split_all.SetToolTip(tooltip)
        link_split_all.AutoBrowse(False)
        link_split_all.UpdateLink()
        link_split_all.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkSplit)

        tooltip = wx.ToolTip(
            _("Manually insert seeds of regions of interest and create a new surface"
              ))
        link_seeds = hl.HyperLinkCtrl(self, -1,
                                      _("Select regions of interest..."))
        link_seeds.SetUnderlines(False, False, False)
        link_seeds.SetColours("BLACK", "BLACK", "BLACK")
        link_seeds.SetToolTip(tooltip)
        link_seeds.AutoBrowse(False)
        link_seeds.UpdateLink()
        link_seeds.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkSeed)

        # Image(s) for buttons
        img_largest = wx.Image(
            os.path.join(const.ICON_DIR, "connectivity_largest.png"),
            wx.BITMAP_TYPE_PNG)
        img_largest.Rescale(25, 25)
        bmp_largest = img_largest.ConvertToBitmap()

        img_split_all = wx.Image(
            os.path.join(const.ICON_DIR, "connectivity_split_all.png"),
            wx.BITMAP_TYPE_PNG)
        img_split_all.Rescale(25, 25)
        bmp_split_all = img_split_all.ConvertToBitmap()

        img_seeds = wx.Image(
            os.path.join(const.ICON_DIR, "connectivity_manual.png"),
            wx.BITMAP_TYPE_PNG)
        img_seeds.Rescale(25, 25)
        bmp_seeds = img_seeds.ConvertToBitmap()

        # Buttons related to hyperlinks
        button_style = pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_DEFAULT
        button_style_plus = button_style | pbtn.PB_STYLE_TOGGLE

        button_split = pbtn.PlateButton(self,
                                        BTN_SPLIT,
                                        "",
                                        bmp_split_all,
                                        style=button_style)
        button_largest = pbtn.PlateButton(self,
                                          BTN_LARGEST,
                                          "",
                                          bmp_largest,
                                          style=button_style)
        button_seeds = pbtn.PlateButton(self,
                                        BTN_SEEDS,
                                        "",
                                        bmp_seeds,
                                        style=button_style_plus)

        self.button_seeds = button_seeds

        # When using PlaneButton, it is necessary to bind events from parent win
        self.Bind(wx.EVT_BUTTON, self.OnButton)
        self.Bind(wx.EVT_TOGGLEBUTTON, self.OnToggleButton)

        # Tags and grid sizer for fixed items
        flag_link = wx.EXPAND | wx.GROW | wx.LEFT | wx.TOP
        flag_button = wx.EXPAND | wx.GROW

        #fixed_sizer = wx.FlexGridSizer(rows=3, cols=2, hgap=2, vgap=0)
        fixed_sizer = wx.FlexGridSizer(rows=3, cols=2, hgap=2, vgap=0)
        fixed_sizer.AddGrowableCol(0, 1)
        fixed_sizer.AddMany([(link_largest, 1, flag_link, 3),
                             (button_largest, 0, flag_button),
                             (link_seeds, 1, flag_link, 3),
                             (button_seeds, 0, flag_button),
                             (link_split_all, 1, flag_link, 3),
                             (button_split, 0, flag_button)])

        # Add line sizers into main sizer
        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(fixed_sizer, 0, wx.GROW | wx.EXPAND | wx.TOP, 5)

        # Update main sizer and panel layout
        self.SetSizerAndFit(main_sizer)
        self.Update()
        self.sizer = main_sizer
Beispiel #2
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        default_colour = self.GetBackgroundColour()
        backgroud_colour = wx.Colour(255, 255, 255)
        self.SetBackgroundColour(backgroud_colour)
        self.SetAutoLayout(1)

        BMP_ADD = wx.Bitmap(os.path.join(const.ICON_DIR, "object_add.png"),
                            wx.BITMAP_TYPE_PNG)
        #BMP_ADD.SetWidth(25)
        #BMP_ADD.SetHeight(25)

        # Button for creating new surface
        button_new_surface = pbtn.PlateButton(self, BTN_NEW, "", BMP_ADD, style=\
                                   pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_DEFAULT)
        button_new_surface.SetBackgroundColour(self.GetBackgroundColour())
        self.Bind(wx.EVT_BUTTON, self.OnButton)

        # Fixed hyperlink items
        tooltip = wx.ToolTip(_("Create 3D surface based on a mask"))
        link_new_surface = hl.HyperLinkCtrl(self, -1,
                                            _("Create new 3D surface"))
        link_new_surface.SetUnderlines(False, False, False)
        link_new_surface.SetBold(True)
        link_new_surface.SetColours("BLACK", "BLACK", "BLACK")
        link_new_surface.SetBackgroundColour(self.GetBackgroundColour())
        link_new_surface.SetToolTip(tooltip)
        link_new_surface.AutoBrowse(False)
        link_new_surface.UpdateLink()
        link_new_surface.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkNewSurface)

        # Create horizontal sizers to represent lines in the panel
        line_new = wx.BoxSizer(wx.HORIZONTAL)
        line_new.Add(link_new_surface, 1,
                     wx.EXPAND | wx.GROW | wx.TOP | wx.RIGHT, 4)
        line_new.Add(button_new_surface, 0, wx.ALL | wx.EXPAND | wx.GROW, 0)

        # Folde panel which contains surface properties and quality
        fold_panel = FoldPanel(self)
        fold_panel.SetBackgroundColour(default_colour)

        # Button to fold to select region task
        button_next = wx.Button(self, -1, _("Next step"))
        if sys.platform != 'win32':
            button_next.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
        button_next.Bind(wx.EVT_BUTTON, self.OnButtonNextTask)

        # Add line sizers into main sizer
        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(line_new, 0,
                       wx.GROW | wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
        main_sizer.Add(fold_panel, 0, wx.GROW | wx.EXPAND | wx.ALL, 5)
        main_sizer.Add(button_next, 0, wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM,
                       5)
        main_sizer.Fit(self)

        self.SetSizerAndFit(main_sizer)
        self.Update()
        #self.SetAutoLayout(1)

        self.sizer = main_sizer
Beispiel #3
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        background_colour = wx.Colour(255, 255, 255)
        self.SetBackgroundColour(background_colour)
        self.SetAutoLayout(1)

        # Image for button
        BMP_ADD = wx.Bitmap("../icons/object_add.png", wx.BITMAP_TYPE_PNG)

        # Button for creating new surface
        button_set_overlay = pbtn.PlateButton(self, BTN_NEW, "", BMP_ADD, style=\
                                   pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_DEFAULT)
        button_set_overlay.SetBackgroundColour(self.GetBackgroundColour())
        self.Bind(wx.EVT_BUTTON, self.OnButton)

        # Fixed hyperlink items
        tooltip = wx.ToolTip(_("Open NIfTI file as overlay"))
        link_set_overlay = hl.HyperLinkCtrl(self, -1, _("Import NIfTI image"))
        link_set_overlay.SetUnderlines(False, False, False)
        link_set_overlay.SetBold(True)
        link_set_overlay.SetColours("BLACK", "BLACK", "BLACK")
        link_set_overlay.SetBackgroundColour(self.GetBackgroundColour())
        link_set_overlay.SetToolTip(tooltip)
        link_set_overlay.AutoBrowse(False)
        link_set_overlay.UpdateLink()
        link_set_overlay.Bind(hl.EVT_HYPERLINK_LEFT, self.OnButton)

        # Create horizontal sizers to represent lines in the panel
        line_new = wx.BoxSizer(wx.HORIZONTAL)
        line_new.Add(link_set_overlay, 1,
                     wx.EXPAND | wx.GROW | wx.TOP | wx.RIGHT, 4)
        line_new.Add(button_set_overlay, 0, wx.ALL | wx.EXPAND | wx.GROW, 0)

        # Button to fold to select region task
        button_info = wx.Button(self, -1, _("fMRI info"))
        check_box = wx.CheckBox(self, -1, _("Hide overlay"))
        self.check_box = check_box
        if sys.platform != 'win32':
            button_info.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
            check_box.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
        button_info.Bind(wx.EVT_BUTTON, self.OnButtonInfo)
        self.check_box.Bind(wx.EVT_CHECKBOX, self.OnCheckBox)

        info_btn_sizer = wx.BoxSizer(wx.VERTICAL)
        info_btn_sizer.Add(button_info, 1, wx.ALIGN_RIGHT)

        line_sizer = wx.BoxSizer(wx.HORIZONTAL)
        line_sizer.Add(check_box, 0, wx.ALIGN_LEFT | wx.RIGHT | wx.LEFT, 5)
        line_sizer.Add(info_btn_sizer, 1,
                       wx.EXPAND | wx.ALIGN_RIGHT | wx.RIGHT | wx.LEFT, 5)
        line_sizer.Fit(self)

        # Add line sizers into main sizer
        main_sizer = wx.BoxSizer(wx.VERTICAL)

        main_sizer.Add(line_new, 0,
                       wx.GROW | wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
        main_sizer.AddSizer(line_sizer, 0, wx.GROW | wx.EXPAND)
        main_sizer.AddSpacer(5)

        inner_panel = InnerFoldPanel(self)
        main_sizer.Add(inner_panel, 1, wx.EXPAND | wx.GROW, 2)
        self.inner_panel = inner_panel

        main_sizer.Fit(self)

        self.SetSizerAndFit(main_sizer)
        self.Update()
        self.SetAutoLayout(1)

        self.sizer = main_sizer
Beispiel #4
0
    def layout(self, status):
        #logo
        self.SetIcon(logo.get_icon())

        #
        wx.StaticLine(parent=self.panel,
                      id=-1,
                      pos=(0, 0),
                      size=(300, -1),
                      style=wx.ALL | wx.EXPAND)

        #WebSite + Account + Password
        wx.StaticText(parent=self.panel,
                      id=-1,
                      label='WebSite:',
                      pos=(24, 15),
                      size=(60, 30))
        self.website = wx.Choice(parent=self.panel,
                                 id=-1,
                                 pos=(90, 7),
                                 size=(180, 30),
                                 choices=SITE_CHOICES)
        self.website.SetSelection(0)

        wx.StaticText(parent=self.panel,
                      id=-1,
                      label='Account:',
                      pos=(25, 47),
                      size=(60, 30))
        self.account = wx.TextCtrl(parent=self.panel,
                                   id=-1,
                                   value='',
                                   pos=(90, 42),
                                   size=(180, 30))

        wx.StaticText(parent=self.panel,
                      id=-1,
                      label='Password:'******'',
                                    pos=(90, 77),
                                    size=(180, 30),
                                    style=wx.TE_PASSWORD | wx.TE_PROCESS_ENTER)

        #Login btn
        self.login_btn = wx.Button(parent=self.panel,
                                   id=-1,
                                   label='Login',
                                   pos=(125, 110),
                                   size=(90, 35))

        #
        wx.StaticLine(parent=self.panel,
                      id=-1,
                      pos=(0, 145),
                      size=(300, -1),
                      style=wx.ALL | wx.EXPAND)

        #site link
        wx.StaticText(parent=self.panel,
                      id=-1,
                      label='Home Page:',
                      pos=(30, 155),
                      size=(90, 30))
        self.link = hyperlink.HyperLinkCtrl(parent=self.panel,
                                            id=-1,
                                            pos=(115, 155))
        self.link.SetURL(URL=HOME_PAGE)
        self.link.SetLabel(label=HOME_PAGE)
        self.link.SetBackgroundColour(self.GetBackgroundColour())

        #status bar
        stbar = MyStatusBar(self)
        self.SetStatusBar(stbar)
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)

        backgroud_colour = wx.Colour(255, 255, 255)

        self.SetBackgroundColour(backgroud_colour)
        self.SetAutoLayout(1)

        # Counter for projects loaded in current GUI
        self.proj_count = 0

        # Floating items (to be inserted)
        self.float_hyper_list = []

        # Fixed hyperlink items
        tooltip = wx.ToolTip(_("Select DICOM files to be reconstructed"))
        link_import_local = hl.HyperLinkCtrl(self, -1,
                                             _("Import DICOM images..."))
        link_import_local.SetUnderlines(False, False, False)
        link_import_local.SetBold(True)
        link_import_local.SetColours("BLACK", "BLACK", "BLACK")
        link_import_local.SetBackgroundColour(backgroud_colour)
        link_import_local.SetToolTip(tooltip)
        link_import_local.AutoBrowse(False)
        link_import_local.UpdateLink()
        link_import_local.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkImport)

        #tooltip = wx.ToolTip("Import DICOM files from PACS server")
        #link_import_pacs = hl.HyperLinkCtrl(self, -1,"Load from PACS server...")
        #link_import_pacs.SetUnderlines(False, False, False)
        #link_import_pacs.SetColours("BLACK", "BLACK", "BLACK")
        #link_import_pacs.SetToolTip(tooltip)
        #link_import_pacs.AutoBrowse(False)
        #link_import_pacs.UpdateLink()
        #link_import_pacs.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkImportPACS)

        tooltip = wx.ToolTip(_("Open an existing InVesalius project..."))
        link_open_proj = hl.HyperLinkCtrl(self, -1,
                                          _("Open an existing project..."))
        link_open_proj.SetUnderlines(False, False, False)
        link_open_proj.SetBold(True)
        link_open_proj.SetColours("BLACK", "BLACK", "BLACK")
        link_open_proj.SetBackgroundColour(backgroud_colour)
        link_open_proj.SetToolTip(tooltip)
        link_open_proj.AutoBrowse(False)
        link_open_proj.UpdateLink()
        link_open_proj.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkOpenProject)

        # Image(s) for buttons
        BMP_IMPORT = wx.Bitmap(os.path.join(const.ICON_DIR, "file_import.png"),
                               wx.BITMAP_TYPE_PNG)
        BMP_NET = wx.Bitmap(
            os.path.join(const.ICON_DIR, "file_from_internet.png"),
            wx.BITMAP_TYPE_PNG)
        BMP_OPEN_PROJECT = wx.Bitmap(
            os.path.join(const.ICON_DIR, "file_open.png"), wx.BITMAP_TYPE_PNG)

        bmp_list = [BMP_IMPORT, BMP_NET, BMP_OPEN_PROJECT]
        #for bmp in bmp_list:
        #bmp.SetWidth(25)
        #bmp.SetHeight(25)

        # Buttons related to hyperlinks
        button_style = pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_DEFAULT

        #button_import_pacs = pbtn.PlateButton(self, BTN_IMPORT_PACS, "", BMP_NET,
        #                                      style=button_style)
        button_import_local = pbtn.PlateButton(self,
                                               BTN_IMPORT_LOCAL,
                                               "",
                                               BMP_IMPORT,
                                               style=button_style)
        button_import_local.SetBackgroundColour(self.GetBackgroundColour())
        button_open_proj = pbtn.PlateButton(self,
                                            BTN_OPEN_PROJECT,
                                            "",
                                            BMP_OPEN_PROJECT,
                                            style=button_style)
        button_open_proj.SetBackgroundColour(self.GetBackgroundColour())

        # When using PlaneButton, it is necessary to bind events from parent win
        self.Bind(wx.EVT_BUTTON, self.OnButton)

        # Tags and grid sizer for fixed items
        flag_link = wx.EXPAND | wx.GROW | wx.LEFT | wx.TOP
        flag_button = wx.EXPAND | wx.GROW

        #fixed_sizer = wx.FlexGridSizer(rows=3, cols=2, hgap=2, vgap=0)
        fixed_sizer = wx.FlexGridSizer(rows=2, cols=2, hgap=2, vgap=0)
        fixed_sizer.AddGrowableCol(0, 1)
        fixed_sizer.AddMany([  #(link_import_pacs, 1, flag_link, 3),
            #(button_import_pacs, 0, flag_button),
            (link_import_local, 1, flag_link, 3),
            (button_import_local, 0, flag_button),
            (link_open_proj, 1, flag_link, 3),
            (button_open_proj, 0, flag_button)
        ])

        # Add line sizers into main sizer
        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(fixed_sizer, 0, wx.GROW | wx.EXPAND)

        # Update main sizer and panel layout
        self.SetSizer(main_sizer)
        self.Update()
        self.SetAutoLayout(1)
        self.sizer = main_sizer

        # Test load and unload specific projects' links
        self.TestLoadProjects2()
Beispiel #6
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        backgroud_colour = wx.Colour(255, 255, 255)
        self.SetBackgroundColour(backgroud_colour)
        self.SetAutoLayout(1)

        # Counter for projects loaded in current GUI

        # Fixed hyperlink items
        tooltip = wx.ToolTip(_("Export InVesalius screen to an image file"))
        link_export_picture = hl.HyperLinkCtrl(self, -1,
                                               _("Export picture..."))
        link_export_picture.SetUnderlines(False, False, False)
        link_export_picture.SetBold(True)
        link_export_picture.SetColours("BLACK", "BLACK", "BLACK")
        link_export_picture.SetBackgroundColour(self.GetBackgroundColour())
        link_export_picture.SetToolTip(tooltip)
        link_export_picture.AutoBrowse(False)
        link_export_picture.UpdateLink()
        link_export_picture.Bind(hl.EVT_HYPERLINK_LEFT,
                                 self.OnLinkExportPicture)

        tooltip = wx.ToolTip(_("Export 3D surface"))
        link_export_surface = hl.HyperLinkCtrl(self, -1,
                                               _("Export 3D surface..."))
        link_export_surface.SetUnderlines(False, False, False)
        link_export_surface.SetBold(True)
        link_export_surface.SetColours("BLACK", "BLACK", "BLACK")
        link_export_surface.SetBackgroundColour(self.GetBackgroundColour())
        link_export_surface.SetToolTip(tooltip)
        link_export_surface.AutoBrowse(False)
        link_export_surface.UpdateLink()
        link_export_surface.Bind(hl.EVT_HYPERLINK_LEFT,
                                 self.OnLinkExportSurface)

        #tooltip = wx.ToolTip(_("Export 3D mask (voxels)"))
        #link_export_mask = hl.HyperLinkCtrl(self, -1,_("Export mask..."))
        #link_export_mask.SetUnderlines(False, False, False)
        #link_export_mask.SetColours("BLACK", "BLACK", "BLACK")
        #link_export_mask.SetToolTip(tooltip)
        #link_export_mask.AutoBrowse(False)
        #link_export_mask.UpdateLink()
        #link_export_mask.Bind(hl.EVT_HYPERLINK_LEFT,
        #                      self.OnLinkExportMask)

        #tooltip = wx.ToolTip("Request rapid prototyping services")
        #link_request_rp = hl.HyperLinkCtrl(self,-1,"Request rapid prototyping...")
        #link_request_rp.SetUnderlines(False, False, False)
        #link_request_rp.SetColours("BLACK", "BLACK", "BLACK")
        #link_request_rp.SetToolTip(tooltip)
        #link_request_rp.AutoBrowse(False)
        #link_request_rp.UpdateLink()
        #link_request_rp.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkRequestRP)

        #tooltip = wx.ToolTip("Open report tool...")
        #link_report = hl.HyperLinkCtrl(self,-1,"Open report tool...")
        #link_report.SetUnderlines(False, False, False)
        #link_report.SetColours("BLACK", "BLACK", "BLACK")
        #link_report.SetToolTip(tooltip)
        #link_report.AutoBrowse(False)
        #link_report.UpdateLink()
        #link_report.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkReport)

        # Image(s) for buttons
        if sys.platform == 'darwin':
            BMP_EXPORT_SURFACE = wx.Bitmap(\
                                  os.path.join(const.ICON_DIR, "surface_export_original.png"),
                                  wx.BITMAP_TYPE_PNG).ConvertToImage()\
                                          .Rescale(25, 25).ConvertToBitmap()
            BMP_TAKE_PICTURE = wx.Bitmap(\
                                 os.path.join(const.ICON_DIR, "tool_photo_original.png"),
                                 wx.BITMAP_TYPE_PNG).ConvertToImage()\
                                          .Rescale(25, 25).ConvertToBitmap()

            #BMP_EXPORT_MASK = wx.Bitmap("../icons/mask.png",
            #                            wx.BITMAP_TYPE_PNG)
        else:
            BMP_EXPORT_SURFACE = wx.Bitmap(os.path.join(const.ICON_DIR, "surface_export.png"),
                                        wx.BITMAP_TYPE_PNG).ConvertToImage()\
                                          .Rescale(25, 25).ConvertToBitmap()

            BMP_TAKE_PICTURE = wx.Bitmap(os.path.join(const.ICON_DIR, "tool_photo.png"),
                                     wx.BITMAP_TYPE_PNG).ConvertToImage()\
                                          .Rescale(25, 25).ConvertToBitmap()

            #BMP_EXPORT_MASK = wx.Bitmap("../icons/mask_small.png",
            #                            wx.BITMAP_TYPE_PNG)

        # Buttons related to hyperlinks
        button_style = pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_DEFAULT

        button_picture = pbtn.PlateButton(self,
                                          BTN_PICTURE,
                                          "",
                                          BMP_TAKE_PICTURE,
                                          style=button_style)
        button_picture.SetBackgroundColour(self.GetBackgroundColour())
        self.button_picture = button_picture

        button_surface = pbtn.PlateButton(self,
                                          BTN_SURFACE,
                                          "",
                                          BMP_EXPORT_SURFACE,
                                          style=button_style)
        button_surface.SetBackgroundColour(self.GetBackgroundColour())
        #button_mask = pbtn.PlateButton(self, BTN_MASK, "",
        #                                BMP_EXPORT_MASK,
        #                                style=button_style)
        #button_request_rp = pbtn.PlateButton(self, BTN_REQUEST_RP, "",
        #                                    BMP_IMPORT, style=button_style)
        #button_report = pbtn.PlateButton(self, BTN_REPORT, "",
        #                                 BMP_IMPORT,
        #                                 style=button_style)

        # When using PlaneButton, it is necessary to bind events from parent win
        self.Bind(wx.EVT_BUTTON, self.OnButton)

        # Tags and grid sizer for fixed items
        flag_link = wx.EXPAND | wx.GROW | wx.LEFT | wx.TOP
        flag_button = wx.EXPAND | wx.GROW

        fixed_sizer = wx.FlexGridSizer(rows=2, cols=2, hgap=2, vgap=0)
        fixed_sizer.AddGrowableCol(0, 1)
        fixed_sizer.AddMany([
            (link_export_picture, 1, flag_link, 3),
            (button_picture, 0, flag_button),
            (link_export_surface, 1, flag_link, 3),
            (button_surface, 0, flag_button),
        ])
        #(link_export_mask, 1, flag_link, 3),
        #(button_mask, 0, flag_button)])
        #(link_report, 0, flag_link, 3),
        #(button_report, 0, flag_button),
        #(link_request_rp, 1, flag_link, 3),
        #(button_request_rp, 0, flag_button)])

        # Add line sizers into main sizer
        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(fixed_sizer, 0, wx.GROW | wx.EXPAND)

        # Update main sizer and panel layout
        self.SetSizer(main_sizer)
        self.Fit()
        self.sizer = main_sizer
        self.__init_menu()
Beispiel #7
0
    def layout(self, status):
        #widgets

        #logo
        self.SetIcon(logo.get_icon())

        wx.StaticLine(parent=self.panel,
                      id=-1,
                      pos=(0, 0),
                      size=(300, -1),
                      style=wx.ALL | wx.EXPAND)

        #Account + Password
        wx.StaticText(parent=self.panel,
                      id=-1,
                      label='Account:',
                      pos=(25, 19),
                      size=(60, 30))
        self.account = wx.TextCtrl(parent=self.panel,
                                   id=-1,
                                   value='',
                                   pos=(90, 15),
                                   size=(180, 30))

        wx.StaticText(parent=self.panel,
                      id=-1,
                      label='Password:'******'',
                                    pos=(90, 50),
                                    size=(180, 30),
                                    style=wx.TE_PASSWORD)

        #Login btn
        self.login_btn = wx.Button(parent=self.panel,
                                   id=-1,
                                   label='Login',
                                   pos=(125, 85),
                                   size=(90, 35))

        wx.StaticLine(parent=self.panel,
                      id=-1,
                      pos=(0, 125),
                      size=(300, -1),
                      style=wx.ALL | wx.EXPAND)

        #site link
        wx.StaticText(parent=self.panel,
                      id=-1,
                      label='Home Page:',
                      pos=(30, 135),
                      size=(90, 30))
        self.link = hyperlink.HyperLinkCtrl(parent=self.panel,
                                            id=-1,
                                            pos=(115, 135))
        self.link.SetURL(URL=HOME_PAGE)
        self.link.SetLabel(label=HOME_PAGE)

        #status
        stbar = MyStatusBar(self)
        self.SetStatusBar(stbar)
Beispiel #8
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        backgroud_colour = wx.Colour(255, 255, 255)
        self.SetBackgroundColour(backgroud_colour)
        self.SetAutoLayout(1)

        # Image(s) for buttons
        BMP_ADD = wx.Bitmap(os.path.join(const.ICON_DIR, "object_add.png"),
                            wx.BITMAP_TYPE_PNG)
        #BMP_ADD.SetWidth(25)
        #BMP_ADD.SetHeight(25)

        # Button for creating new surface
        button_new_mask = pbtn.PlateButton(self, BTN_NEW, "", BMP_ADD, style=\
                                   pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_DEFAULT)
        button_new_mask.SetBackgroundColour(self.GetBackgroundColour())
        self.Bind(wx.EVT_BUTTON, self.OnButton)

        # Fixed hyperlink items
        tooltip = wx.ToolTip(
            _("Create mask for slice segmentation and editing"))
        link_new_mask = hl.HyperLinkCtrl(self, -1, _("Create new mask"))
        link_new_mask.SetUnderlines(False, False, False)
        link_new_mask.SetBold(True)
        link_new_mask.SetColours("BLACK", "BLACK", "BLACK")
        link_new_mask.SetBackgroundColour(self.GetBackgroundColour())
        link_new_mask.SetToolTip(tooltip)
        link_new_mask.AutoBrowse(False)
        link_new_mask.UpdateLink()
        link_new_mask.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkNewMask)

        # Create horizontal sizers to represent lines in the panel
        line_new = wx.BoxSizer(wx.HORIZONTAL)
        line_new.Add(link_new_mask, 1, wx.EXPAND | wx.GROW | wx.TOP | wx.RIGHT,
                     4)
        line_new.Add(button_new_mask, 0, wx.ALL | wx.EXPAND | wx.GROW, 0)

        # Fold panel which contains mask properties and edition tools
        #print wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND)
        #print wx.SystemSettings_GetColour(wx.SYS_COLOUR_APPWORKSPACE)
        #print wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNFACE)
        #print wx.SystemSettings_GetColour(wx.SYS_COLOUR_DESKTOP)
        #print wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUBAR)
        #print wx.SystemSettings_GetColour(wx.SYS_COLOUR_SCROLLBAR)
        #print wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUHILIGHT)
        default_colour = wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUBAR)
        fold_panel = FoldPanel(self)
        fold_panel.SetBackgroundColour(default_colour)
        self.fold_panel = fold_panel

        # Button to fold to select region task
        button_next = wx.Button(self, -1, _("Create surface"))
        check_box = wx.CheckBox(self, -1, _("Overwrite last surface"))
        self.check_box = check_box
        if sys.platform != 'win32':
            button_next.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
            check_box.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
        button_next.Bind(wx.EVT_BUTTON, self.OnButtonNextTask)

        next_btn_sizer = wx.BoxSizer(wx.VERTICAL)
        next_btn_sizer.Add(button_next, 1, wx.ALIGN_RIGHT)

        line_sizer = wx.BoxSizer(wx.HORIZONTAL)
        line_sizer.Add(check_box, 0, wx.ALIGN_LEFT | wx.RIGHT | wx.LEFT, 5)
        line_sizer.Add(next_btn_sizer, 1,
                       wx.EXPAND | wx.ALIGN_RIGHT | wx.RIGHT | wx.LEFT, 5)
        line_sizer.Fit(self)

        # Add line sizers into main sizer
        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(line_new, 0,
                       wx.GROW | wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
        main_sizer.Add(fold_panel, 1, wx.GROW | wx.EXPAND | wx.ALL, 5)
        main_sizer.AddSizer(line_sizer, 0, wx.GROW | wx.EXPAND)
        main_sizer.AddSpacer(5)
        main_sizer.Fit(self)

        self.SetSizerAndFit(main_sizer)
        self.Update()
        self.SetAutoLayout(1)

        self.sizer = main_sizer
Beispiel #9
0
    def __init_ctrls(self, parent):
        wx.Dialog.__init__(self,
                           id=wxID_ABOUT,
                           name=u'About',
                           parent=parent,
                           style=wx.DEFAULT_DIALOG_STYLE,
                           title=_(u"About Metamorphose"))
        self.SetIcon(wx.Icon(utils.icon_path(u'about.ico'),
                             wx.BITMAP_TYPE_ICO))

        fontParams = app.fontParams
        fontSize = fontParams['size']
        fontFamily = fontParams['family']
        fontStyle = fontParams['style']

        self.SetFont(
            wx.Font(fontSize + 1, fontFamily, fontStyle, wx.NORMAL, False,
                    u'Times New Roman'))
        self.Center(wx.HORIZONTAL | wx.VERTICAL)
        self.SetThemeEnabled(True)

        self.greet = wx.StaticText(id=wxID_ABOUTGREET,
                                   label=u"Métamorphose 2",
                                   name=u'greet',
                                   parent=self)
        self.greet.SetFont(
            wx.Font(fontSize + 4, fontFamily, fontStyle, wx.BOLD, False))

        self.CLOSE = wx.BitmapButton(
            id=wxID_ABOUTCLOSE,
            bitmap=wx.Bitmap(utils.icon_path(u'metamorphose128.png'),
                             wx.BITMAP_TYPE_PNG),
            name=u'CLOSE',
            parent=self,
            style=wx.BU_AUTODRAW)
        self.CLOSE.SetToolTipString(_(u"Click here to exit"))
        self.CLOSE.Bind(wx.EVT_BUTTON,
                        self.on_close_button,
                        id=wxID_ABOUTCLOSE)

        self.copyright = wx.StaticText(
            id=wxID_ABOUTCOPYRIGHT,
            label=u"Copyright © 2006-2015 Ianaré Sévi",
            name=u'copyright',
            parent=self)
        self.copyright.SetFont(
            wx.Font(fontSize + 2, fontFamily, fontStyle, wx.BOLD, False))

        self.version = wx.StaticText(id=wxID_ABOUTVERSION,
                                     label=_(u"Version: %s") % app.version,
                                     name=u'version',
                                     parent=self)
        self.version.SetFont(
            wx.Font(fontSize + 2, fontFamily, fontStyle, wx.BOLD, False))

        self.wxVersion = wx.StaticText(
            id=wxID_ABOUTWXVERSION,
            label=_(u"Using Python %s, wxPython %s") %
            (platform.python_version(), self._get_wxversion()),
            name=u'version',
            parent=self)
        self.wxVersion.SetFont(
            wx.Font(fontSize + 1, fontFamily, fontStyle, wx.NORMAL, False))

        self.link = hl.HyperLinkCtrl(
            self,
            wxID_ABOUTLINK,
            _(u"Metamorphose Home Page"),
            URL=u'http://file-folder-ren.sourceforge.net/',
            style=0)

        self.bugReport = hl.HyperLinkCtrl(
            self,
            wxID_ABOUTLINK,
            _(u"GitHub Project Page"),
            URL=u'https://github.com/metamorphose/metamorphose2')
        self.bugReport.Show(True)

        self.donateButton = wx.Button(id=wxID_PANELDONATEBUTTON,
                                      label=_(u"Donate"),
                                      name=u'donateButton',
                                      parent=self)
        self.donateButton.SetFont(
            wx.Font(fontSize + 4, fontFamily, fontStyle, wx.BOLD, False,
                    u'Times New Roman'))
        self.donateButton.Bind(wx.EVT_BUTTON,
                               self.on_donate_button,
                               id=wxID_PANELDONATEBUTTON)

        self.donate = hl.HyperLinkCtrl(
            self,
            wxID_ABOUTDONATE,
            _(u"Donate"),
            URL=u'http://sourceforge.net/donate/index.php?group_id=146403')
        self.donate.Show(False)

        self.licenseButton = wx.Button(id=wxID_PANELLICENSEBUTTON,
                                       label=_(u"License"),
                                       name=u'licenseButton',
                                       parent=self)
        self.licenseButton.Bind(wx.EVT_BUTTON,
                                self.show_small_help,
                                id=wxID_PANELLICENSEBUTTON)

        self.creditsButton = wx.Button(id=wxID_PANELCREDITSBUTTON,
                                       label=_(u"Credits"),
                                       name=u'licenseButton',
                                       parent=self)
        self.creditsButton.Bind(wx.EVT_BUTTON,
                                self.show_small_help,
                                id=wxID_PANELCREDITSBUTTON)