예제 #1
0
    def __init__(self, parent, toolbar_scan):
        Workbench.__init__(self, parent, name=_('Scanning workbench'))

        self.scanning = False
        self.toolbar_scan = toolbar_scan

        # Elements
        self.play_tool = self.toolbar_scan.AddTool(
            wx.NewId(), _("Play"),
            wx.Bitmap(resources.get_path_for_image("play.png")), shortHelp=_("Play"))
        self.stop_tool = self.toolbar_scan.AddTool(
            wx.NewId(), _("Stop"),
            wx.Bitmap(resources.get_path_for_image("stop.png")), shortHelp=_("Stop"))
        self.pause_tool = self.toolbar_scan.AddTool(
            wx.NewId(), _("Pause"),
            wx.Bitmap(resources.get_path_for_image("pause.png")), shortHelp=_("Pause"))
        self.toolbar_scan.Realize()
        self.toolbar_scan.GetParent().Layout()

        ciclop_scan.point_cloud_callback = self.point_cloud_callback

        self._enable_tool_scan(self.play_tool, False)
        self._enable_tool_scan(self.stop_tool, False)
        self._enable_tool_scan(self.pause_tool, False)

        # Events
        self.toolbar_scan.GetParent().Bind(wx.EVT_TOOL, self.on_play_tool_clicked, self.play_tool)
        self.toolbar_scan.GetParent().Bind(wx.EVT_TOOL, self.on_stop_tool_clicked, self.stop_tool)
        self.toolbar_scan.GetParent().Bind(wx.EVT_TOOL, self.on_pause_tool_clicked, self.pause_tool)
예제 #2
0
    def __init__(self,
                 parent,
                 on_connect_callback=None,
                 on_disconnect_callback=None):

        Toolbar.__init__(self, parent)

        self.on_connect_callback = on_connect_callback
        self.on_disconnect_callback = on_disconnect_callback

        # Elements
        self.connect_tool = self.toolbar.AddLabelTool(
            wx.NewId(),
            _("Connect"),
            wx.Bitmap(resources.get_path_for_image("connect.png")),
            shortHelp=_("Connect"))
        self.disconnect_tool = self.toolbar.AddLabelTool(
            wx.NewId(),
            _("Disconnect"),
            wx.Bitmap(resources.get_path_for_image("disconnect.png")),
            shortHelp=_("Disconnect"))
        self.toolbar.Realize()

        self._enable_tool(self.connect_tool, True)
        self._enable_tool(self.disconnect_tool, False)

        # Events
        self.Bind(wx.EVT_TOOL, self.on_connect_tool_clicked, self.connect_tool)
        self.Bind(wx.EVT_TOOL, self.on_disconnect_tool_clicked,
                  self.disconnect_tool)
예제 #3
0
    def __init__(self, parent, title="", selected_callback=None,
                 has_undo=True, has_restore=True, restore_callback=None):
        wx.Panel.__init__(self, parent, size=(-1, -1))

        # Elements
        self.parent = parent
        self.expand_callback = None
        self.selected_callback = selected_callback
        self.undo_objects = []
        self.title = title
        self.title_text = TitleText(self, title)
        self.has_undo = has_undo
        self.has_restore = has_restore
        self.restore_callback = restore_callback
        if self.has_undo:
            self.undo_button = wx.BitmapButton(
                self, wx.NewId(),
                wx.Bitmap(resources.get_path_for_image("undo.png"), wx.BITMAP_TYPE_ANY))
            self.undo_button.Disable()
        if self.has_restore:
            self.restore_button = wx.BitmapButton(
                self, wx.NewId(),
                wx.Bitmap(resources.get_path_for_image("restore.png"), wx.BITMAP_TYPE_ANY))

        self.content = ControlCollection(self, self.append_undo, self.release_undo)

        # Layout
        self.vbox = wx.BoxSizer(wx.VERTICAL)
        self.hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox.Add(self.title_text, 1, wx.ALIGN_CENTER_VERTICAL)
        if self.has_undo:
            self.hbox.Add(
                self.undo_button, 0, wx.RIGHT | wx.BOTTOM , 5)
        if self.has_restore:
            self.hbox.Add(
                self.restore_button, 0, wx.RIGHT | wx.BOTTOM , 5)
        self.vbox.Add(self.hbox, 0, wx.TOP | wx.BOTTOM | wx.EXPAND, 5)
        self.vbox.Add(self.content, 1, wx.ALL ^ wx.TOP ^ wx.BOTTOM | wx.EXPAND, 15)
        self.SetSizer(self.vbox)
        self.Layout()

        # Events
        if self.has_undo:
            self.undo_button.Bind(wx.EVT_BUTTON, self.on_undo_button_clicked)
        if self.has_restore:
            self.restore_button.Bind(wx.EVT_BUTTON, self.on_restore_button_clicked)
        self.title_text.title.Bind(wx.EVT_LEFT_DOWN, self.on_title_clicked)

        # Initialize
        self.add_controls()
        self.update_callbacks()
예제 #4
0
    def __init__(self,
                 parent,
                 title='Video page',
                 start_callback=None,
                 cancel_callback=None):
        Page.__init__(self,
                      parent,
                      title=title,
                      desc=_("Put the pattern on the platform as shown in the "
                             "picture and press \"Start\""),
                      left=_("Cancel"),
                      right=_("Start"),
                      button_left_callback=cancel_callback,
                      button_right_callback=start_callback,
                      view_progress=True)

        # Elements
        image_view = ImageView(self.panel, quality=wx.IMAGE_QUALITY_HIGH)
        image_view.set_image(
            wx.Image(resources.get_path_for_image("pattern-position.png")))
        self.video_view = VideoView(self.panel, self.get_image)

        # Layout
        self.panel_box.Add(image_view, 3, wx.ALL | wx.EXPAND, 3)
        self.panel_box.Add(self.video_view, 2, wx.ALL | wx.EXPAND, 3)
        self.Layout()
예제 #5
0
 def on_about(self, event):
     info = wx.AboutDialogInfo()
     icon = wx.Icon(resources.get_path_for_image("horus.ico"),
                    wx.BITMAP_TYPE_ICO)
     info.SetIcon(icon)
     info.SetName(u'Horus')
     info.SetVersion(__version__)
     tech_description = _('Horus is an Open Source 3D Scanner manager')
     tech_description += '\nVersion: ' + __version__
     tech_description += '\nDatetime: ' + __datetime__
     tech_description += '\nCommit: ' + __commit__
     info.SetDescription(tech_description)
     info.SetCopyright(u'(C) 2014-2016 Mundo Reader S.L.')
     info.SetWebSite(u'http://www.bq.com')
     info.SetLicence(
         "Horus is free software; you can redistribute it and/or modify it\n"
         "under the terms of the GNU General Public License as published by\n"
         "the Free Software Foundation; either version 2 of the License,\n"
         "or (at your option) any later version.\n"
         "Horus is distributed in the hope that it will be useful,\n"
         "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
         "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
         "See the GNU General Public License for more details. You should have\n"
         "received a copy of the GNU General Public License along with\n"
         "File Hunter; if not, write to the Free Software Foundation,\n"
         "Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA")
     info.AddDeveloper(u'Jesús Arroyo, Irene Sanz, Jorge Robles')
     info.AddDocWriter(u'Jesús Arroyo, Ángel Larrañaga')
     info.AddArtist(u'Nestor Toribio')
     info.AddTranslator(
         u'Jesús Arroyo, Irene Sanz, Alexandre Galode, Natasha da Silva, '
         'Camille Montgolfier, Markus Hoedl, Andrea Fantini, Maria Albuquerque, '
         'Meike Schirmeister')
     wx.AboutBox(info)
예제 #6
0
    def __init__(self,
                 parent,
                 resize=True,
                 quality=wx.IMAGE_QUALITY_NORMAL,
                 size=(-1, -1),
                 black=False,
                 style=wx.NO_BORDER):
        wx.Panel.__init__(self, parent, size=size, style=style)

        self.x_offset = 0
        self.y_offset = 0
        self.quality = quality

        self.default_image = wx.Image(resources.get_path_for_image("nusb.png"))
        self.image = self.default_image
        self.bitmap = wx.BitmapFromImage(self.default_image)
        #        self.bitmap = wx.Bitmap.ConvertToImage(wx.Bitmap(self.default_image))

        self.black = black
        self.frame = None
        self.current_size = self.GetSizeTuple()
        self.SetDoubleBuffered(True)

        self.Bind(wx.EVT_SHOW, self.on_show)
        self.Bind(wx.EVT_PAINT, self.on_paint)
        if resize:
            self.Bind(wx.EVT_SIZE, self.on_resize)

        self.hide = False
예제 #7
0
    def __init__(self, callback):
        self.callback = callback

        bitmap = wx.Image(get_path_for_image("splash.png"),
                          wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        super(SplashScreen,
              self).__init__(bitmap, wx.adv.SPLASH_CENTRE_ON_SCREEN, 0, None)
        # TODO: fix in wx.SplashScreen class
        time.sleep(0.03)
        wx.CallAfter(self.do_callback)
예제 #8
0
 def initialize(self):
     self.desc_text.SetLabel(
         _("Default values are recommended. To perform the calibration, "
           "click over the video panel and press "
           "space bar to perform the captures."))
     self.current_grid = 0
     self.gauge.SetValue(0)
     camera_intrinsics.reset()
     for panel in xrange(self.rows * self.columns):
         self.panel_grid[panel].SetBackgroundColour((221, 221, 221))
         self.panel_grid[panel].set_image(wx.Image(resources.get_path_for_image("void.png")))
예제 #9
0
    def __init__(self, parent):
        super(PatternDistanceWindow,
              self).__init__(parent,
                             title=_("Pattern distance"),
                             size=(420, -1),
                             style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)

        self.value = float(profile.settings['pattern_origin_distance'])

        # Elements
        self.description = wx.StaticText(
            self,
            label=_("The pattern distance value must be higher than 0. "
                    "Please change it in the textbox below."))
        self.description.Wrap(400)
        tooltip = _(
            "Minimum distance between the origin of the pattern (bottom-left corner) "
            "and the pattern's base surface (mm)")
        self.image = wx.Image(
            resources.get_path_for_image('pattern-distance.jpg'),
            wx.BITMAP_TYPE_ANY)
        self.image = wx.StaticBitmap(self, wx.ID_ANY,
                                     wx.BitmapFromImage(self.image))
        self.image.SetToolTip(wx.ToolTip(tooltip))
        self.label = wx.StaticText(self, label=_("Pattern distance (mm)"))
        self.label.SetToolTip(wx.ToolTip(tooltip))
        self.text_box = wx.TextCtrl(
            self, value=str(profile.settings['pattern_origin_distance']))
        self.ok_button = wx.Button(self, label=_("Accept"))
        self.cancel_button = wx.Button(self, label=_("Cancel"))

        # Events
        self.text_box.Bind(wx.EVT_TEXT, self.on_text_box_changed)
        self.cancel_button.Bind(wx.EVT_BUTTON, self.on_close)
        self.ok_button.Bind(wx.EVT_BUTTON, self.on_ok)
        self.Bind(wx.EVT_CLOSE, self.on_close)

        # Layout
        vbox = wx.BoxSizer(wx.VERTICAL)
        vbox.Add(self.description, 0, wx.ALL | wx.CENTER, 10)
        vbox.Add(self.image, 0, wx.ALL | wx.CENTER, 10)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add(self.label, 0, wx.ALL, 7)
        hbox.Add(self.text_box, 0, wx.ALL, 3)
        hbox.Add(self.ok_button, 0, wx.ALL, 3)
        hbox.Add(self.cancel_button, 0, wx.ALL, 3)
        vbox.Add(hbox, 0, wx.ALL | wx.CENTER, 10)
        self.SetSizer(vbox)
        self.CenterOnScreen()
        self.Fit()

        self.ShowModal()
예제 #10
0
    def __init__(self,
                 parent,
                 button_prev_callback=None,
                 button_next_callback=None):
        WizardPage.__init__(self,
                            parent,
                            title=_("Calibration"),
                            button_prev_callback=button_prev_callback,
                            button_next_callback=button_next_callback)

        self.parent = parent

        self.pattern_label = wx.StaticText(
            self.panel,
            label=
            _("Put the pattern on the platform as shown in the picture and press \"Calibrate\""
              ))
        self.pattern_label.Wrap(400)
        self.image_view = ImageView(self.panel, quality=wx.IMAGE_QUALITY_HIGH)
        self.image_view.set_image(
            wx.Image(resources.get_path_for_image("pattern-position.png")))
        self.calibrate_button = wx.Button(self.panel, label=_("Calibrate"))
        self.cancel_button = wx.Button(self.panel, label=_("Cancel"))
        self.gauge = wx.Gauge(self.panel, range=100, size=(-1, 30))
        self.result_label = wx.StaticText(self.panel, size=(-1, 30))

        self.cancel_button.Disable()
        self.result_label.Hide()
        self.skip_button.Enable()
        self.next_button.Disable()

        # Layout
        vbox = wx.BoxSizer(wx.VERTICAL)
        vbox.Add(self.pattern_label, 0, wx.ALL | wx.CENTER, 5)
        vbox.Add(self.image_view, 1, wx.ALL | wx.EXPAND, 5)
        vbox.Add(self.result_label, 0, wx.ALL | wx.CENTER, 5)
        vbox.Add(self.gauge, 0, wx.ALL | wx.EXPAND, 5)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add(self.cancel_button, 1, wx.ALL | wx.EXPAND, 5)
        hbox.Add(self.calibrate_button, 1, wx.ALL | wx.EXPAND, 5)
        vbox.Add(hbox, 0, wx.ALL | wx.EXPAND, 2)
        self.panel.SetSizer(vbox)

        self.Layout()

        self.calibrate_button.Bind(wx.EVT_BUTTON,
                                   self.on_calibration_button_clicked)
        self.cancel_button.Bind(wx.EVT_BUTTON, self.on_cancel_button_clicked)
        self.Bind(wx.EVT_SHOW, self.on_show)

        self.video_view.set_callback(self.get_image)
예제 #11
0
    def __init__(self, parent, toolbar, scanning_workbench,
                 on_normal_computing_ended, on_mesh_reconstruction_ended):
        self.parent = parent
        self.toolbar = toolbar
        self.on_normal_computing_ended = on_normal_computing_ended
        self.on_mesh_reconstruction_ended = on_mesh_reconstruction_ended
        self.scanning_workbench = scanning_workbench
        # Elements
        self.normals_calculation_tool = self.toolbar.AddLabelTool(
            wx.NewId(),
            _("Normals calculation"),
            wx.Bitmap(resources.get_path_for_image("connect.png")),
            shortHelp=_("Normals calculation"))
        self.mesh_reconstruction_tool = self.toolbar.AddLabelTool(
            wx.NewId(),
            _("Mesh reconstruction"),
            wx.Bitmap(resources.get_path_for_image("disconnect.png")),
            shortHelp=_("Mesh reconstruction"))
        self.toolbar.Realize()

        self._enable_tool(self.normals_calculation_tool, True)
        self._enable_tool(self.mesh_reconstruction_tool, True)

        self.normals_calculation_thread = None
        self.normals_calculation_thread_dialog = None
        self.normals_is_calculated = False

        self.reconstruction_thread = None
        self.reconstruction_thread_dialog = None
        self.is_reconstructed = False

        # Events
        self.toolbar.Bind(wx.EVT_TOOL, self.on_normals_calculation_clicked,
                          self.normals_calculation_tool)
        self.toolbar.Bind(wx.EVT_TOOL, self.on_mesh_reconstruction_clicked,
                          self.mesh_reconstruction_tool)
예제 #12
0
def load_gl_texture(filename):
    tex = glGenTextures(1)
    glBindTexture(GL_TEXTURE_2D, tex)
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
    img = wx.ImageFromBitmap(wx.Bitmap(get_path_for_image(filename)))
    rgb_data = img.GetData()
    alpha_data = img.GetAlphaData()
    if alpha_data is not None:
        data = ''
        for i in xrange(0, len(alpha_data)):
            data += rgb_data[i * 3:i * 3 + 3] + alpha_data[i]
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.GetWidth(),
                     img.GetHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, data)
    else:
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.GetWidth(),
                     img.GetHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, rgb_data)
    return tex
예제 #13
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)

        # Elements
        logo = ImageView(self)
        logo.set_image(wx.Image(resources.get_path_for_image("logo.png")))
        title_text = wx.StaticText(self, label=_("3D scanning for everyone"))
        title_font = title_text.GetFont()
        title_font.SetPointSize(14)
        title_text.SetFont(title_font)
        separator = wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL)

        # Layout
        vbox = wx.BoxSizer(wx.VERTICAL)
        vbox.Add(logo, 10, wx.ALL ^ wx.BOTTOM | wx.EXPAND, 30)
        vbox.Add(title_text, 0, wx.TOP | wx.CENTER, 20)
        vbox.Add((0, 0), 1, wx.ALL | wx.EXPAND, 0)
        vbox.Add(separator, 0, wx.ALL | wx.EXPAND, 10)
        self.SetSizer(vbox)
        self.Layout()
예제 #14
0
파일: main.py 프로젝트: DocTrucker/horus3
    def __init__(self):
        wx.Frame.__init__(self, None, title=__title__, size=(980, 623))

        logger.info("Start application " + __title__)

        # Initialize driver
        self.initialize_driver()
        self.last_files = profile.settings['last_files']

        # Initialize GUI
        self.load_menu()
        self.load_workbenches()
        self.update_profile_to_all_controls()

        ws, hs = self.GetSize()
        x, y, w, h = wx.Display(0).GetGeometry()
        self.SetMinSize((800, 450))
        self.SetPosition((x + (w - ws) / 2., y + (h - hs) / 2.))
        self.SetIcon(wx.Icon(resources.get_path_for_image("horus.ico"), wx.BITMAP_TYPE_ICO))

        self.Bind(wx.EVT_CLOSE, self.on_close)
예제 #15
0
def load_gl_texture(filename):
    tex = glGenTextures(1)
    glBindTexture(GL_TEXTURE_2D, tex)
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
    img = wx.ImageFromBitmap(wx.Bitmap(get_path_for_image(filename)))
    #    img = wx.Bitmap.ConvertToImage(wx.Bitmap(get_path_for_image(filename)))
    rgb_data = img.GetData()
    #old    alpha_data = img.GetAlphaData()
    alpha_data = img.GetAlpha()
    #    alpha_data = alpha_data.hex()
    #    if alpha_data is not None:
    #        data = ''
    #        for i in range(0, len(alpha_data)):
    #            data += rgb_data[i * 3:i * 3 + 3] + alpha_data[i]
    #            print('aa')
    #        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.GetWidth(),
    #                     img.GetHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, data)
    #    else:
    #        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.GetWidth(),
    #                     img.GetHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, rgb_data)
    return tex