Ejemplo n.º 1
0
  def run(self):
    """The run() function defines the frame and starts the main loop.
    self._init_lock is released only when all initialisation is done.

    Whatever thread is the current one when wxWindows is initialised
    is what it will consider the "main thread." For wxPython 2.4 that
    happens when wxPython.wx is imported the first time.  For 2.5 it
    will be when the wx.App object is created.
    """

    import wx
    from wxtbx import bitmaps
    app = wx.App(0)
    self._bitmap_pause = bitmaps.fetch_icon_bitmap('actions', 'stop')
    self._bitmap_run = bitmaps.fetch_icon_bitmap('actions', 'runit')
    self._frame = XrayFrame(None, -1, "X-ray image display", size=(800, 720))

    self._frame.Bind(wx.EVT_IDLE, self.OnIdle)

    self.setup_toolbar(self._frame.toolbar)
    self._frame.Show()

    self._init_lock.release()
    app.MainLoop()

    # Avoid deadlock where the send_data() function is waiting for the
    # semaphore after the frame has closed.
    self._next_semaphore.release()
Ejemplo n.º 2
0
    def run(self):
        """The run() function defines the frame and starts the main loop.
    self._init_lock is released only when all initialisation is done.

    Whatever thread is the current one when wxWindows is initialised
    is what it will consider the "main thread." For wxPython 2.4 that
    happens when wxPython.wx is imported the first time.  For 2.5 it
    will be when the wx.App object is created.
    """

        import wx
        from wxtbx import bitmaps
        app = wx.App(0)
        self._bitmap_pause = bitmaps.fetch_icon_bitmap('actions', 'stop')
        self._bitmap_run = bitmaps.fetch_icon_bitmap('actions', 'runit')
        self._frame = XrayFrame(None,
                                -1,
                                "X-ray image display",
                                size=(800, 720))

        self._frame.Bind(wx.EVT_IDLE, self.OnIdle)

        self.setup_toolbar(self._frame.toolbar)
        self._frame.Show()

        self._init_lock.release()
        app.MainLoop()

        # Avoid deadlock where the send_data() function is waiting for the
        # semaphore after the frame has closed.
        self._next_semaphore.release()
Ejemplo n.º 3
0
  def __init__(self, parent):
    wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)

    self.index = None
    self.btn_box = wx.BoxSizer(wx.HORIZONTAL)

    viewmag_bmp = bitmaps.fetch_icon_bitmap('actions', 'viewmag', size=16)
    # self.btn_mag = btn.GenBitmapButton(self, bitmap=viewmag_bmp)
    self.btn_mag =GradButton(self, bmp=viewmag_bmp, size=(31, 30),
                             gradient_percent=0)

    del_bmp = bitmaps.fetch_icon_bitmap('actions', 'editdelete', size=16)
    # self.btn_delete = btn.GenBitmapButton(self, bitmap=del_bmp)
    self.btn_delete = GradButton(self, bmp=del_bmp, size=(31, 30),
                                 gradient_percent=0)

    info_bmp = bitmaps.fetch_icon_bitmap('actions', 'info', size=16)
    # self.btn_info = btn.GenBitmapButton(self, bitmap=info_bmp)
    self.btn_info = GradButton(self, bmp=info_bmp, size=(31, 30),
                               gradient_percent=0)

    self.btn_box.Add(self.btn_mag)
    self.btn_box.Add(self.btn_delete, flag=wx.LEFT, border=5)
    self.btn_box.Add(self.btn_info, flag=wx.LEFT, border=5)
    self.SetSizer(self.btn_box)
    self.SetBackgroundColour('white')
    self.Fit()
Ejemplo n.º 4
0
    def __init__(self, nb):
        Tab.__init__(self, nb)
        self.project_list = wx.ListCtrl(self, -1, style=wx.LC_REPORT, size=(700, 400))
        self.project_list.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self._load_project)
        
        self._il = wx.ImageList(16,16)
        self._il.Add(bitmaps.fetch_icon_bitmap("actions", "agt_action_success", scale=(16,16)))
        self.project_list.SetImageList(self._il, wx.IMAGE_LIST_SMALL)        

        titles = ['', 'Title', '# Jobs', 'Last Action']
        sizes = [20,400, 100,140]
        for i,t in enumerate(titles):
            self.project_list.InsertColumn(i, t)
            self.project_list.SetColumnWidth(i, sizes[i])
        
        self.sidebar = wx.BoxSizer(wx.VERTICAL)
        
        new = metallicbutton.MetallicButton(self, -1, 'New', '', bitmaps.fetch_icon_bitmap("actions", "folder_new"), size=(120,40))
        delete = metallicbutton.MetallicButton(self, -1, 'Delete', '', bitmaps.fetch_icon_bitmap("actions", "fileclose"), size=(120,40))
        load = metallicbutton.MetallicButton(self, -1, 'Load', '', bitmaps.fetch_icon_bitmap("actions", "folder"), size=(120,40))
         
        self.Bind(wx.EVT_BUTTON, self._new_project, new)
        self.Bind(wx.EVT_BUTTON, self._load_project, load)
        self.Bind(wx.EVT_BUTTON, self._delete_project, delete)
                
        self.sidebar.Add(new, 0, wx.EXPAND|wx.ALL, 5)
        self.sidebar.Add(load, 0, wx.EXPAND|wx.ALL, 5)
        self.sidebar.Add(delete, 0, wx.EXPAND|wx.ALL, 5)
        
        self.sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.sizer.Add(self.project_list, 0, wx.EXPAND | wx.ALL, 5)
        self.sizer.Add(self.sidebar, 0, wx.EXPAND | wx.ALL, 5)
        
        self.SetSizer(self.sizer)
Ejemplo n.º 5
0
  def __init__ (self, *args, **kwds) :
    from wxtbx import bitmaps

    super(ScoreSettingsPanel, self).__init__(*args, **kwds)

    # Needed for communication with the root frame.
    self._root_frame = self.GetParent().GetParent()

    sizer = wx.BoxSizer(wx.VERTICAL)
    self.SetSizer(sizer)

    self._id_text = wx.NewId()
    text = wx.StaticText(self, id= self._id_text, label="")
    sizer.Add(text, flag=wx.ALIGN_CENTER)

    # The score buttons.  XXX Would really like this to be stars or
    # some such.  Could then zap the static text above.
    box = wx.BoxSizer(wx.HORIZONTAL)
    self._id_buttons = []
    for i in range(6):
      btn = wx.Button(self, label="%d" % i)
      box.Add(btn, flag=wx.ALIGN_CENTER, border=5)
      self.Bind(wx.EVT_BUTTON, self.OnScore, btn)
      self._id_buttons.append(btn.GetId())
    sizer.Add(box)

    # XXX Would like to have label and short help for the buttons.
    # Buttons in wxWidgets version 2.9.1 and later support text and
    # bitmap, see SetBitmap, SetBitmapLabel, SetBitmapDisabled, etc.
    box = wx.BoxSizer(wx.HORIZONTAL)

    self._id_previous = wx.NewId()
    btn = wx.BitmapButton(
      self,
      id=self._id_previous,
      bitmap=bitmaps.fetch_icon_bitmap('actions', '1leftarrow'),
      style=wx.BORDER_NONE)
    box.Add(btn, flag=wx.ALIGN_CENTER, border=5)
    self.Bind(wx.EVT_BUTTON, self.OnPrevious, btn)

    btn = wx.Button(self, label="Save scores")
    box.Add(btn, flag=wx.ALIGN_CENTER, border=5)
    self.Bind(wx.EVT_BUTTON, self.OnSave, btn)

    self._id_next = wx.NewId()
    btn = wx.BitmapButton(
      self,
      id=self._id_next,
      bitmap=bitmaps.fetch_icon_bitmap('actions', '1rightarrow'),
      style=wx.BORDER_NONE)
    box.Add(btn, flag=wx.ALIGN_CENTER, border=5)
    self.Bind(wx.EVT_BUTTON, self.OnNext, btn)

    sizer.Add(box, flag=wx.ALIGN_CENTER)

    # Register update events for the dynamic widgets.
    self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateNext, id=self._id_next)
    self.Bind(wx.EVT_UPDATE_UI, self.OnUpdatePrevious, id=self._id_previous)
    self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateText, id=self._id_text)
Ejemplo n.º 6
0
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title)
        self.parent = parent
        self.simtbx_phil = inp.generate_simtbx_phil()
        self.sparams = self.simtbx_phil.extract()

        #self.simtbx_phil.show()

        # Setup main sizer
        self.main_sizer = wx.BoxSizer(wx.VERTICAL)

        # Setup toolbar
        self.toolbar = self.CreateToolBar(style=wx.TB_TEXT)
        quit_bmp = bitmaps.fetch_icon_bitmap('actions', 'exit')
        self.tb_btn_quit = self.toolbar.AddLabelTool(
            wx.ID_EXIT,
            label='Quit',
            bitmap=quit_bmp,
            shortHelp='Quit',
            longHelp='Quit image tracker')
        self.toolbar.AddSeparator()
        run_bmp = bitmaps.fetch_icon_bitmap('actions', 'run')
        self.tb_btn_run = self.toolbar.AddLabelTool(wx.ID_ANY,
                                                    label='Run',
                                                    bitmap=run_bmp,
                                                    shortHelp='Run',
                                                    longHelp='Run Spotfinding')
        self.toolbar.Realize()

        #Processing status bar
        self.sb = self.CreateStatusBar()
        self.sb.SetFieldsCount(2)
        self.sb.SetStatusWidths([-1, -2])

        # Output gauge in status bar
        self.gauge_process = wx.Gauge(self.sb,
                                      -1,
                                      style=wx.GA_HORIZONTAL | wx.GA_SMOOTH)
        rect = self.sb.GetFieldRect(0)
        self.gauge_process.SetPosition((rect.x + 2, rect.y + 2))
        self.gauge_process.SetSize((rect.width - 4, rect.height - 4))
        self.gauge_process.Hide()

        # Instantiate windows
        self.top_window = frm.TopPanel(self)

        # Single input window
        self.main_sizer.Add(self.top_window,
                            1,
                            flag=wx.ALL | wx.EXPAND,
                            border=10)
        self.main_sizer.Add((-1, 20))

        # Bindings
        self.Bind(wx.EVT_TOOL, self.onQuit, self.tb_btn_quit)
        self.Bind(wx.EVT_TOOL, self.onRun, self.tb_btn_run)
        self.Bind(wx.EVT_BUTTON, self.onRunPreview,
                  self.top_window.opt_btn_prev)
Ejemplo n.º 7
0
    def __init__(self,
                 parent,
                 label_style='bold',
                 content_style='normal',
                 *args,
                 **kwargs):

        dlg_style = wx.CAPTION | wx.CLOSE_BOX | wx.RESIZE_BORDER | wx.STAY_ON_TOP
        IOTABaseDialog.__init__(self,
                                parent,
                                style=dlg_style,
                                label_style=label_style,
                                content_style=content_style,
                                size=(400, 400),
                                title='Recover Completed Run',
                                *args,
                                **kwargs)

        self.pathlist = wx.ListCtrl(self,
                                    style=wx.LC_REPORT | wx.LC_SINGLE_SEL)
        self.selected = None
        self.recovery_mode = 0

        self.pathlist.InsertColumn(0, "")
        self.pathlist.InsertColumn(1, "Status")
        self.pathlist.InsertColumn(2, "Path")

        bmps = wx.ImageList(width=16, height=16)
        finished_bmp = bitmaps.fetch_icon_bitmap('actions',
                                                 'button_ok',
                                                 size=16)
        aborted_bmp = bitmaps.fetch_icon_bitmap('actions', 'cancel', size=16)
        unknown_bmp = bitmaps.fetch_icon_bitmap('actions',
                                                'status_unknown',
                                                size=16)
        bmps.Add(finished_bmp)
        bmps.Add(aborted_bmp)
        bmps.Add(unknown_bmp)
        self.pathlist.AssignImageList(bmps, which=1)

        self.envelope.Add(self.pathlist, 1, flag=wx.EXPAND | wx.ALL, border=10)

        # Dialog control
        self.dlg_ctr = ct.DialogButtonsCtrl(
            self,
            preset='OK_CANCEL',
            choices=['everything', 'settings only'],
            choice_label='Recover: ')
        self.envelope.Add(self.dlg_ctr,
                          flag=wx.EXPAND | wx.ALIGN_RIGHT | wx.ALL,
                          border=10)

        self.Bind(wx.EVT_BUTTON, self.onOK, id=wx.ID_OK)
        self.Bind(wx.EVT_BUTTON, self.onCancel, self.dlg_ctr.btn_cancel)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onItemActivated, id=-1)

        self.place_and_size(set_by='parent', set_size='dialog')
Ejemplo n.º 8
0
 def show_buttons(self):
     if hasattr(self, 'abortb'):
         self.abortb.Hide()
     
     self.logb = metallicbutton.MetallicButton(self, -1, 'View Log', '', bitmaps.fetch_icon_bitmap("mimetypes", "log"), size=(105, 34))
     self.cootb = metallicbutton.MetallicButton(self, -1, 'View In Coot', '', bitmaps.fetch_icon_bitmap("custom", "coot"), size=(105, 34))
     
     self.Bind(wx.EVT_BUTTON, self.view_log, self.logb)
     self.Bind(wx.EVT_BUTTON, self.load_coot, self.cootb)
     self.button_sizer.Add(self.logb, 0, wx.EXPAND|wx.ALL, 2)
     self.button_sizer.Add(self.cootb, 0, wx.EXPAND|wx.ALL, 2)
 
     self.Fit()
Ejemplo n.º 9
0
    def __init__(self,
                 parent,
                 label_style='bold',
                 content_style='normal',
                 *args,
                 **kwargs):

        dlg_style = wx.CAPTION | wx.CLOSE_BOX | wx.RESIZE_BORDER | wx.STAY_ON_TOP
        BaseDialog.__init__(self,
                            parent,
                            style=dlg_style,
                            label_style=label_style,
                            content_style=content_style,
                            size=(400, 400),
                            title='Recover Completed Run',
                            *args,
                            **kwargs)

        self.pathlist = wx.ListCtrl(self,
                                    style=wx.LC_REPORT | wx.LC_SINGLE_SEL)
        self.selected = None

        self.pathlist.InsertColumn(0, "")
        self.pathlist.InsertColumn(1, "Status")
        self.pathlist.InsertColumn(2, "Path")

        bmps = wx.ImageList(width=16, height=16)
        finished_bmp = bitmaps.fetch_icon_bitmap('actions',
                                                 'button_ok',
                                                 size=16)
        aborted_bmp = bitmaps.fetch_icon_bitmap('actions', 'cancel', size=16)
        unknown_bmp = bitmaps.fetch_icon_bitmap('actions',
                                                'status_unknown',
                                                size=16)
        bmps.Add(finished_bmp)
        bmps.Add(aborted_bmp)
        bmps.Add(unknown_bmp)
        self.pathlist.AssignImageList(bmps, which=1)

        self.main_sizer.Add(self.pathlist,
                            1,
                            flag=wx.EXPAND | wx.ALL,
                            border=10)

        # Dialog control
        self.main_sizer.Add(self.CreateSeparatedButtonSizer(wx.OK | wx.CANCEL),
                            flag=wx.EXPAND | wx.ALIGN_RIGHT | wx.ALL,
                            border=10)

        self.Bind(wx.EVT_BUTTON, self.onOK, id=wx.ID_OK)
Ejemplo n.º 10
0
  def __init__(self, parent,
               label='', label_size=(100, -1),
               label_style='normal',
               buttons=False, value=''):

    CtrlBase.__init__(self, parent=parent, label_style=label_style)

    self.value=value

    output_box = wx.FlexGridSizer(1, 4, 0, 10)
    self.txt = wx.StaticText(self, label=label, size=label_size)
    self.txt.SetFont(self.font)
    output_box.Add(self.txt)

    self.ctr = wx.TextCtrl(self)
    self.ctr.SetValue(self.value)
    output_box.Add(self.ctr, flag=wx.EXPAND)

    self.btn_browse = wx.Button(self, label='Browse...')
    viewmag_bmp = bitmaps.fetch_icon_bitmap('actions', 'viewmag', size=16)
    self.btn_mag = wx.BitmapButton(self, bitmap=viewmag_bmp)
    output_box.Add(self.btn_browse, flag=wx.RESERVE_SPACE_EVEN_IF_HIDDEN)
    output_box.Add(self.btn_mag, flag=wx.RESERVE_SPACE_EVEN_IF_HIDDEN)

    if not buttons:
      self.btn_browse.Hide()
      self.btn_mag.Hide()

    output_box.AddGrowableCol(1, 1)
    self.SetSizer(output_box)
Ejemplo n.º 11
0
  def add_tool(self, id=wx.ID_ANY, label=None, bitmap=None,
               kind=wx.ITEM_NORMAL, shortHelp=None, longHelp=None):
    if type(bitmap) in (tuple, list):
      if len(bitmap) == 3:
        bsz = bitmap[2]
        bsc = (bitmap[2], bitmap[2])
      else:
        bsz = bsc = None
      if bitmap[0] == 'custom':
        bmp = bitmaps.fetch_custom_icon_bitmap(bitmap[1], size=bsz)
      else:
        bmp = bitmaps.fetch_icon_bitmap(bitmap[0], bitmap[1], scale=bsc)
    else:
      bmp = bitmap

    short_string = shortHelp if shortHelp else ''
    long_string = longHelp if longHelp else ''

    if wx4:
      return self.toolbar.AddTool(toolId=id,
                                  label=label,
                                  kind=kind,
                                  bitmap=bmp,
                                  shortHelp=short_string)
    else:
      return self.toolbar.AddLabelTool(id=id,
                                       label=label,
                                       kind=kind,
                                       bitmap=bmp,
                                       shortHelp=short_string,
                                       longHelp=long_string)
    def add_item(self, path):
        # Generate item
        inp_choices, inp_sel = self.set_type_choices(path)
        type_choice = ct.DataTypeChoice(self.ctr, choices=inp_choices)
        item = ct.InputListItem(path=path,
                                type=type_choice,
                                buttons=ct.MiniButtonBoxInput(self.ctr))

        self.Bind(wx.EVT_CHOICE, self.onTypeChoice, item.type.type)
        item.buttons.btn_mag.Bind(wx.EVT_BUTTON, self.onMagButton)
        item.buttons.btn_delete.Bind(wx.EVT_BUTTON, self.onDelButton)
        item.buttons.btn_info.Bind(wx.EVT_BUTTON, self.onInfoButton)

        # Insert list item
        idx = self.ctr.InsertStringItem(self.ctr.GetItemCount() + 1, item.path)
        self.ctr.SetItemWindow(idx, 1, item.type, expand=True)
        self.ctr.SetItemWindow(idx, 2, item.buttons, expand=True)

        # Set drop-down selection, check it for data and open other tabs
        item.type.type.SetSelection(inp_sel)
        if item.type.type.GetString(inp_sel) in [
                'processed pickle', 'processed pickle list',
                'processed pickle folder'
        ]:
            self.main_window.toolbar.EnableTool(
                self.main_window.tb_btn_run.GetId(), True)
        elif item.type.type.GetString(inp_sel) == 'reference MTZ':
            self.input_window.opt_chk_useref.Enable()
        elif item.type.type.GetString(inp_sel) == 'sequence':
            pass
        else:
            warn_bmp = bitmaps.fetch_icon_bitmap('actions',
                                                 'status_unknown',
                                                 size=16)
            item.buttons.btn_info.SetBitmapLabel(warn_bmp)
            item.warning = True

        # Record index in all relevant places
        item.id = idx
        item.buttons.index = idx
        item.type.index = idx
        item.type_selection = inp_sel

        # Resize columns to fit content
        col1_width = max([
            self.ctr.GetItemWindow(s, col=1).type.GetSize()[0]
            for s in range(self.ctr.GetItemCount())
        ]) + 5
        col2_width = item.buttons.GetSize()[0] + 15
        col0_width = self.ctr.GetSize()[0] - col1_width - col2_width
        self.ctr.SetColumnWidth(0, col0_width)
        self.ctr.SetColumnWidth(1, col1_width)
        self.ctr.SetColumnWidth(2, col2_width)

        # Make sure all the choice lists are the same size
        if item.type.type.GetSize()[0] < col1_width - 5:
            item.type.type.SetSize((col1_width - 5, -1))

        # Attach data object to item
        self.ctr.SetItemData(item.id, item)
Ejemplo n.º 13
0
 def start_refinement(self, type, root, title, res, resl, cycles, ins, hkl, id, options):
     self.abortb = metallicbutton.MetallicButton(self, -1, 'Abort', '', bitmaps.fetch_icon_bitmap("actions", "stop"), size=(105, 34))
     self.Bind(wx.EVT_BUTTON, self.abort, self.abortb)
     self.button_sizer.Add(self.abortb, 0, wx.EXPAND|wx.ALL, 2)
     self.Fit()
     
     self._refinement = Refinement(self, type, root, title, res, resl, cycles, ins, hkl, id, options)
     self._refinement.set_callbacks(self._refinement_started, self._refinement_running, self._refinement_cycle, self._refinement_finished, self._error_dialog)
Ejemplo n.º 14
0
 def setup_toolbar(self):
     btn = self.toolbar.AddTool(
         toolId=-1,
         label="Load file",
         bitmap=icons.hkl_file.GetBitmap(),
         shortHelp="Load file",
         kind=wx.ITEM_NORMAL,
     )
     self.Bind(wx.EVT_MENU, self.OnLoadFile, btn)
     btn = self.toolbar.AddTool(
         toolId=-1,
         label="Settings",
         bitmap=icons.advancedsettings.GetBitmap(),
         shortHelp="Settings",
         kind=wx.ITEM_NORMAL,
     )
     self.Bind(wx.EVT_MENU, self.OnShowSettings, btn)
     btn = self.toolbar.AddTool(
         toolId=-1,
         label="Zoom",
         bitmap=icons.search.GetBitmap(),
         shortHelp="Zoom",
         kind=wx.ITEM_NORMAL,
     )
     self.Bind(wx.EVT_MENU, self.OnZoom, btn)
     txt = wx.StaticText(self.toolbar, -1, "Image:")
     self.toolbar.AddControl(txt)
     self.image_chooser = wx.Choice(self.toolbar, -1, size=(300, -1))
     self.toolbar.AddControl(self.image_chooser)
     self.Bind(wx.EVT_CHOICE, self.OnChooseImage, self.image_chooser)
     btn = self.toolbar.AddTool(
         toolId=wx.ID_BACKWARD,
         label="Previous",
         bitmap=bitmaps.fetch_icon_bitmap("actions", "1leftarrow"),
         shortHelp="Previous",
         kind=wx.ITEM_NORMAL,
     )
     self.Bind(wx.EVT_MENU, self.OnPrevious, btn)
     btn = self.toolbar.AddTool(
         toolId=wx.ID_FORWARD,
         label="Next",
         bitmap=bitmaps.fetch_icon_bitmap("actions", "1rightarrow"),
         shortHelp="Next",
         kind=wx.ITEM_NORMAL,
     )
     self.Bind(wx.EVT_MENU, self.OnNext, btn)
Ejemplo n.º 15
0
    def __init__(self, nb):
        Tab.__init__(self, nb)
        
        self.job_list = wx.ListCtrl(self, -1, style=wx.LC_REPORT|wx.LC_SINGLE_SEL, size=(700, 400))
        self.job_list.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self._load_job)
        
        titles = ['ID', 'Date', 'Title', 'Type', 'Status', 'R']
        sizes = [65,135,225,130,80,60]
        for i,t in enumerate(titles):
            self.job_list.InsertColumn(i, t, width=sizes[i])

        new = metallicbutton.MetallicButton(self, -1, 'New', '', bitmaps.fetch_icon_bitmap("actions", "window_new"), size=(120,40))
        load = metallicbutton.MetallicButton(self, -1, 'Load', '', bitmaps.fetch_icon_bitmap("actions", "fileopen"), size=(120,40))
        delete = metallicbutton.MetallicButton(self, -1, 'Delete', '', bitmaps.fetch_icon_bitmap("actions", "fileclose"), size=(120,40))
        sum = metallicbutton.MetallicButton(self, -1, 'Summary', '', bitmaps.fetch_icon_bitmap("actions", "info"), size=(120,40))
                
        self.Bind(wx.EVT_BUTTON, self._new_job, new)
        self.Bind(wx.EVT_BUTTON, self._load_job, load)
        self.Bind(wx.EVT_BUTTON, self._delete_job, delete)
        self.Bind(wx.EVT_BUTTON, self._show_summary, sum)
                
        import_cif = metallicbutton.MetallicButton(self, -1, 'Import HKL', '', icons.hkl_file.GetBitmap(), size=(120,40))
        import_pdb = metallicbutton.MetallicButton(self, -1, 'Import PDB', '', icons.pdb_file.GetBitmap(), size=(120,40))
        rcsb_dl = metallicbutton.MetallicButton(self, -1, 'RCSB PDB', '', bitmaps.fetch_icon_bitmap("actions", "down"), size=(120,40))
        self.Bind(wx.EVT_BUTTON, self._import_pbd, import_pdb)
        self.Bind(wx.EVT_BUTTON, self._import_cif, import_cif)
        self.Bind(wx.EVT_BUTTON, self._download_files, rcsb_dl)
        
        self.sidebar = wx.BoxSizer(wx.VERTICAL)
        self.sidebar.Add(new, 0, wx.EXPAND | wx.ALL, 5)
        self.sidebar.Add(load, 0, wx.EXPAND | wx.ALL, 5)
        self.sidebar.Add(sum, 0, wx.EXPAND | wx.ALL, 5)
        self.sidebar.Add(delete, 0, wx.EXPAND | wx.ALL, 5)
        self.sidebar.AddSpacer(20)
                
        self.sidebar.Add(import_cif, 0, wx.EXPAND | wx.ALL, 5)
        self.sidebar.Add(import_pdb, 0, wx.EXPAND | wx.ALL, 5)
        self.sidebar.AddSpacer(10)
        self.sidebar.Add(rcsb_dl, 0, wx.EXPAND | wx.ALL, 5)
                
        self.main = wx.BoxSizer(wx.HORIZONTAL)
        self.main.Add(self.job_list, 0, wx.EXPAND|wx.ALL, 5)
        self.main.Add(self.sidebar, 0, wx.EXPAND|wx.ALL, 5)
        
        self.SetSizer(self.main)
Ejemplo n.º 16
0
  def setup_toolbar(self):
    XFBaseClass.setup_toolbar(self)

    btn = self.toolbar.AddLabelTool(id=wx.ID_SAVEAS,
    label="Save As...",
    bitmap=bitmaps.fetch_icon_bitmap("actions","save_all", 32),
    shortHelp="Save As...",
    kind=wx.ITEM_NORMAL)
    self.Bind(wx.EVT_MENU, self.OnSaveAs, btn)
Ejemplo n.º 17
0
    def add_item(self, path):
        # Generate item
        inputs, inp_choices, inp_sel = self.set_type_choices(path)
        type_choice = ct.DataTypeChoice(self.ctr, choices=inp_choices)
        item = ct.InputListItem(path=path,
                                type=type_choice,
                                buttons=ct.MiniButtonBoxInput(self.ctr))

        self.Bind(wx.EVT_CHOICE, self.onTypeChoice, item.type.type)
        # item.buttons.btn_mag.Bind(wx.EVT_BUTTON, self.onMagButton)
        # item.buttons.btn_delete.Bind(wx.EVT_BUTTON, self.onDelButton)
        # item.buttons.btn_info.Bind(wx.EVT_BUTTON, self.onInfoButton)
        self.Bind(wx.EVT_BUTTON, self.onMagButton, item.buttons.btn_mag)
        self.Bind(wx.EVT_BUTTON, self.onDelButton, item.buttons.btn_delete)
        self.Bind(wx.EVT_BUTTON, self.onInfoButton, item.buttons.btn_info)

        # Insert list item
        idx = self.ctr.InsertStringItem(self.ctr.GetItemCount() + 1, item.path)
        self.ctr.SetItemWindow(idx, 1, item.type, expand=True)
        self.ctr.SetItemWindow(idx, 2, item.buttons, expand=True)

        # Set drop-down selection, check it for data and open other tabs
        item.type.type.SetSelection(inp_sel)
        if item.type.type.GetString(inp_sel) in ('coordinates',
                                                 'structure factors',
                                                 'background',
                                                 'raw image file'):
            if "image" in item.type.type.GetString(inp_sel):
                view_bmp = bitmaps.fetch_custom_icon_bitmap('image_viewer16')
                item.buttons.btn_mag.SetBitmapLabel(view_bmp)
        else:
            warn_bmp = bitmaps.fetch_icon_bitmap('actions',
                                                 'status_unknown',
                                                 size=16)
            item.buttons.btn_info.SetBitmapLabel(warn_bmp)
            item.warning = True

        # Record index in all relevant places
        item.id = idx
        item.buttons.index = idx
        item.type.index = idx
        item.type_selection = inp_sel

        # Resize columns to fit content
        self.ctr.SetColumnWidth(1, width=-1)
        self.ctr.SetColumnWidth(2, width=-1)
        self.ctr.SetColumnWidth(0, width=-3)

        # Make sure all the choice lists are the same size
        if item.type.type.GetSize()[0] < self.ctr.GetColumnWidth(2) - 5:
            item.type.type.SetSize((self.ctr.GetColumnWidth(2) - 5, -1))

        # Attach data object to item
        self.ctr.SetItemData(item.id, item)

        self.Layout()
Ejemplo n.º 18
0
 def setup_toolbar(self):
   tb_buttons = [
     ("Show/hide controls",
      bitmaps.fetch_icon_bitmap("apps", "advancedsettings"),
      self.OnToggleControls),
     ("Save",
      bitmaps.fetch_icon_bitmap("actions", "save_all"),
      self.OnSave),
     #("Print",
     # bitmaps.fetch_icon_bitmap("devices", "printer1"),
     # self.OnPrint),
   ]
   tb = wx.ToolBar(self, style=wx.TB_3DBUTTONS|wx.TB_TEXT)
   tb.SetToolBitmapSize((32,32))
   self.SetToolBar(tb)
   for (name, bitmap, function) in tb_buttons :
     tool_button = tb.AddLabelTool(-1, name, bitmap, kind=wx.ITEM_NORMAL)
     self.Bind(wx.EVT_MENU, function, tool_button)
   self.toolbar = tb
Ejemplo n.º 19
0
  def __init__(self, parent):
    wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)

    self.index = None
    self.btn_box = wx.BoxSizer(wx.HORIZONTAL)
    view_bmp = bitmaps.fetch_custom_icon_bitmap('image_viewer16')
    self.btn_viewer = btn.GenBitmapButton(self, bitmap=view_bmp)
    viewmag_bmp = bitmaps.fetch_icon_bitmap('actions', 'viewmag', size=16)
    self.btn_mag = btn.GenBitmapButton(self, bitmap=viewmag_bmp)
    star_on_bmp = bitmaps.fetch_icon_bitmap('actions', 'bookmark_gold',
                                            size=16)
    star_off_bmp = bitmaps.fetch_icon_bitmap('actions', 'bookmark_silver',
                                             size=16)
    self.btn_flag = btn.GenBitmapToggleButton(self, bitmap=star_off_bmp)
    self.btn_flag.SetBitmapSelected(star_on_bmp)
    self.btn_box.Add(self.btn_mag)
    self.btn_box.Add(self.btn_viewer, flag=wx.LEFT, border=5)
    self.btn_box.Add(self.btn_flag, flag=wx.LEFT, border=5)
    self.SetSizer(self.btn_box)
    self.SetBackgroundColour('white')
    self.Fit()
Ejemplo n.º 20
0
 def setup_toolbar (self) :
   btn = self.toolbar.AddLabelTool(id=-1,
     label="Load file",
     bitmap=icons.hkl_file.GetBitmap(),
     shortHelp="Load file",
     kind=wx.ITEM_NORMAL)
   self.Bind(wx.EVT_MENU, self.OnLoadFile, btn)
   btn = self.toolbar.AddLabelTool(id=-1,
     label="Settings",
     bitmap=icons.advancedsettings.GetBitmap(),
     shortHelp="Settings",
     kind=wx.ITEM_NORMAL)
   self.Bind(wx.EVT_MENU, self.OnShowSettings, btn)
   btn = self.toolbar.AddLabelTool(id=-1,
     label="Zoom",
     bitmap=icons.search.GetBitmap(),
     shortHelp="Zoom",
     kind=wx.ITEM_NORMAL)
   self.Bind(wx.EVT_MENU, self.OnZoom, btn)
   txt = wx.StaticText(self.toolbar, -1, "Image:")
   self.toolbar.AddControl(txt)
   self.image_chooser = wx.Choice(self.toolbar, -1, size=(300,-1))
   self.toolbar.AddControl(self.image_chooser)
   self.Bind(wx.EVT_CHOICE, self.OnChooseImage, self.image_chooser)
   btn = self.toolbar.AddLabelTool(id=wx.ID_BACKWARD,
     label="Previous",
     bitmap=bitmaps.fetch_icon_bitmap("actions","1leftarrow"),
     shortHelp="Previous",
     kind=wx.ITEM_NORMAL)
   self.Bind(wx.EVT_MENU, self.OnPrevious, btn)
   btn = self.toolbar.AddLabelTool(id=wx.ID_FORWARD,
     label="Next",
     bitmap=bitmaps.fetch_icon_bitmap("actions","1rightarrow"),
     shortHelp="Next",
     kind=wx.ITEM_NORMAL)
   self.Bind(wx.EVT_MENU, self.OnNext, btn)
Ejemplo n.º 21
0
 def SetupToolbar (self) :
   self.toolbar = self.CreateToolBar(style=wx.TB_3DBUTTONS|wx.TB_TEXT)
   self.toolbar.SetToolBitmapSize((32,32))
   btn = self.toolbar.AddLabelTool(id=-1,
     label="Load file",
     bitmap=icons.hkl_file.GetBitmap(),
     shortHelp="Load file",
     kind=wx.ITEM_NORMAL)
   self.Bind(wx.EVT_MENU, self.OnLoadFile, btn)
   btn = self.toolbar.AddLabelTool(id=-1,
     label="Save image",
     bitmap=icons.save_all.GetBitmap(),
     shortHelp="Save image",
     kind=wx.ITEM_NORMAL)
   self.Bind(wx.EVT_MENU, self.OnSave, btn)
   btn = self.toolbar.AddLabelTool(id=-1,
     label="Delete reflection",
     bitmap=bitmaps.fetch_icon_bitmap("actions","editdelete"), # FIXME
     shortHelp="Delete reflection",
     kind=wx.ITEM_NORMAL)
   self.Bind(wx.EVT_MENU, self.OnDeleteReflection, btn)
Ejemplo n.º 22
0
 def SetupToolbar (self) :
   self.toolbar = self.CreateToolBar(style=wx.TB_3DBUTTONS|wx.TB_TEXT)
   self.toolbar.SetToolBitmapSize((32,32))
   btn = self.toolbar.AddLabelTool(id=-1,
     label="Load file",
     bitmap=icons.hkl_file.GetBitmap(),
     shortHelp="Load file",
     kind=wx.ITEM_NORMAL)
   self.Bind(wx.EVT_MENU, self.OnLoadFile, btn)
   btn = self.toolbar.AddLabelTool(id=-1,
     label="Save image",
     bitmap=icons.save_all.GetBitmap(),
     shortHelp="Save image",
     kind=wx.ITEM_NORMAL)
   self.Bind(wx.EVT_MENU, self.OnSave, btn)
   btn = self.toolbar.AddLabelTool(id=-1,
     label="Delete reflection",
     bitmap=bitmaps.fetch_icon_bitmap("actions","editdelete"), # FIXME
     shortHelp="Delete reflection",
     kind=wx.ITEM_NORMAL)
   self.Bind(wx.EVT_MENU, self.OnDeleteReflection, btn)
Ejemplo n.º 23
0
    def __init__(self, pdb_file='/Users/vxn01537/Dropbox/Proton8/test/3HLX.pdb', name='', *args, **kwargs):
        wx.Frame.__init__(self,None,-1,'Ligand Explorer: ' + name, size=(800,700))
        
        if os.path.exists(pdb_file):
            p = pdb.input(pdb_file)
        else:
            self.Destroy()
            
        cols = {'C': 'black', 'O': 'red', 'N': 'blue', 'S': 'green', 'H': 'white'}

        self._refresh = False
        self._labs = []
        self._alabs = []

        self._ligands = {}
        for a in p.atoms_with_labels():
            if a.resname not in ['ARG', 'HIS', 'LYS', 'ASP', 'GLU', 'SER', 'THR',
                                 'ASN', 'GLN', 'CYS', 'GLY', 'PRO', 'ALA', 'ILE',
                                 'LEU', 'MET', 'PHE', 'TRP', 'TYR', 'VAL', 'HOH', 'DOD']:
                key = '%s %s-%s' % (a.chain_id, a.resname, a.resid().strip())
                if not key in self._ligands:
                    self._ligands[key] = {'at': [], 'id': a.resid().strip()}
            
                self._ligands[key]['at'].append(a)

        to_del = []
        for k,l in self._ligands.iteritems():
            l['c'] = np.array([ a.xyz for a in l['at']])
            l['col'] = np.array([ cols.get(a.element.strip() if a.element.strip() else a.name.strip()[0], 'black') for a in l['at']])
            if len(l['at']) < 3:
                to_del.append(k)

            l['rex'] = {}
            l['stdevs'] = {}
            for a in l['at']:
                an = a.name.strip()
                for b in l['at']:
                    bn = b.name.strip()
                    if a is not b:
                        if a.distance(b) < 1.8:
                            l['rex'][an+'-'+bn] = [re.compile(an+'_'+l['id']+' '+bn+'_'+l['id']+' (\d+\.?\d+)\((\d+)\)'),
                            re.compile(bn+'_'+l['id']+' '+an+'_'+l['id']+' (\d+\.?\d+)\((\d+)\)')]
    
    
        for d in to_del:
            del self._ligands[d]
        
        
        if 'stdevs' in kwargs:
            if os.path.exists(kwargs['stdevs']):
                stdevs = open(kwargs['stdevs'])
                start = False
                for l in stdevs:
                    if  '_geom_bond_atom_site_label_1' in l:
                        start = True
                    if '_geom_angle_atom_site_label_1' in l:
                        break
                
                    if start:
                        for k,lig in self._ligands.iteritems():
                            for id,rs in lig['rex'].iteritems():
                                for r in rs:
                                    m = r.match(l)
                                    if m:
                                        d = pow(10, len((m.group(1).split('.'))[1]))
                                        lig['stdevs'][id] = float(m.group(2))/d

                stdevs.close()
    
        

        self.toolbar = wx.ToolBar(self, style=wx.TB_3DBUTTONS|wx.TB_TEXT)                
                
        self.res_type = wx.ComboBox(self.toolbar, -1, choices=sorted(self._ligands.keys()), style=wx.CB_READONLY)
        self.res_type.Bind(wx.EVT_COMBOBOX, self._load_residue)

        close = self.toolbar.AddLabelTool(wx.ID_ANY, 'Close', bitmaps.fetch_icon_bitmap("actions", "no"))
        self.toolbar.AddSeparator()
        self.toolbar.AddControl(self.res_type)
        self.toolbar.AddSeparator()
        save = self.toolbar.AddLabelTool(wx.ID_ANY, 'Save Figure', bitmaps.fetch_icon_bitmap("actions", "save_all"))
    
        self.Bind(wx.EVT_TOOL, self._close, close)
        self.Bind(wx.EVT_TOOL, self._save_figure, save)
                
        self.SetToolBar(self.toolbar)
        self.toolbar.Realize()
                
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.viewer = LigandViewer(self)
        self.sizer.Add(self.viewer, 1, wx.EXPAND)

        self.SetSizer(self.sizer)
        #self.Fit()
    
        self._load_residue('')
Ejemplo n.º 24
0
    def __init__(self, *args, **kwds):
        from wxtbx import bitmaps

        super(ScoreSettingsPanel, self).__init__(*args, **kwds)

        # Needed for communication with the root frame.
        self._root_frame = self.GetParent().GetParent()

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(sizer)

        self._id_text = wx.NewId()
        text = wx.StaticText(self, id=self._id_text, label="")
        sizer.Add(text, flag=wx.ALIGN_CENTER)

        # The score buttons.  XXX Would really like this to be stars or
        # some such.  Could then zap the static text above.
        box = wx.BoxSizer(wx.HORIZONTAL)
        self._id_buttons = []
        self._id_accel = []
        accelerators = []
        for idx, i in enumerate(choices):
            btn = wx.Button(self, label=i)
            box.Add(btn, flag=wx.ALIGN_CENTER, border=5)
            self.Bind(wx.EVT_BUTTON, self.OnScore, btn)
            self._id_buttons.append(btn.GetId())
            randomId = wx.NewId()
            self._id_accel.append(randomId)
            self.Bind(wx.EVT_MENU, self.OnKeyCombo, id=randomId)
            accelerators.append(
                (wx.ACCEL_NORMAL, ord(shortcuts[idx]), randomId))
        sizer.Add(box)
        accel_tbl = wx.AcceleratorTable(accelerators)
        self.SetAcceleratorTable(accel_tbl)

        # XXX Would like to have label and short help for the buttons.
        # Buttons in wxWidgets version 2.9.1 and later support text and
        # bitmap, see SetBitmap, SetBitmapLabel, SetBitmapDisabled, etc.
        box = wx.BoxSizer(wx.HORIZONTAL)

        self._id_previous = wx.NewId()
        btn = wx.BitmapButton(self,
                              id=self._id_previous,
                              bitmap=bitmaps.fetch_icon_bitmap(
                                  'actions', '1leftarrow'),
                              style=wx.BORDER_NONE)
        box.Add(btn, flag=wx.ALIGN_CENTER, border=5)
        self.Bind(wx.EVT_BUTTON, self.OnPrevious, btn)

        btn = wx.Button(self, label="Save scores")
        box.Add(btn, flag=wx.ALIGN_CENTER, border=5)
        self.Bind(wx.EVT_BUTTON, self.OnSave, btn)

        self._id_next = wx.NewId()
        btn = wx.BitmapButton(self,
                              id=self._id_next,
                              bitmap=bitmaps.fetch_icon_bitmap(
                                  'actions', '1rightarrow'),
                              style=wx.BORDER_NONE)
        box.Add(btn, flag=wx.ALIGN_CENTER, border=5)
        self.Bind(wx.EVT_BUTTON, self.OnNext, btn)

        sizer.Add(box, flag=wx.ALIGN_CENTER)

        # Register update events for the dynamic widgets.
        self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateNext, id=self._id_next)
        self.Bind(wx.EVT_UPDATE_UI,
                  self.OnUpdatePrevious,
                  id=self._id_previous)
        self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateText, id=self._id_text)

        for i in xrange(self._root_frame.image_chooser.GetCount()):
            _scores[self._root_frame.get_key(
                self._root_frame.image_chooser.GetClientData(i))] = None
Ejemplo n.º 25
0
    def __init__(self, parent, id, title, inputs, refls, in_files, ref_files, selected_refls=None, selected_struct=None, resh=None):
        wx.Dialog.__init__(self, parent, id, title)

        self._in_files = in_files
        self._ref_files = ref_files
        self._residue_list = []
        
        if not selected_refls in refls:
            selected_refls = None
    
        if not selected_struct in inputs:
            selected_struct = None
        
        self.input_sizer = wx.FlexGridSizer(rows=0, cols=2, vgap=5, hgap=5)
        self.input_sizer.Add(wx.StaticText(self, -1, 'Title'))

        self._title = wx.TextCtrl(self, -1, '', (30, 200))
        self.input_sizer.Add(self._title, 0, wx.EXPAND)
            
        self.input_sizer.Add(wx.StaticText(self, -1, 'Reflections'))
        self._reflections = wx.ComboBox(self, -1, choices=refls, style=wx.CB_READONLY)
        self._reflections.Bind(wx.EVT_COMBOBOX, self._set_res)
        self._view_refs = metallicbutton.MetallicButton(self, 0, '', '', bitmaps.fetch_icon_bitmap('actions', 'viewmag', scale=(16,16)), size=(22, 20))
        self.Bind(wx.EVT_BUTTON, self._view_file, self._view_refs)
        
        self._refs_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self._refs_sizer.Add(self._view_refs, 0, wx.EXPAND|wx.RIGHT, 5)
        self._refs_sizer.Add(self._reflections, 1, wx.EXPAND)
        
        self.input_sizer.Add(self._refs_sizer, 0, wx.EXPAND)

        self.input_sizer.Add(wx.StaticText(self, -1, 'Structure'))
        self._structure = wx.ComboBox(self, -1, choices=inputs, style=wx.CB_READONLY)
        self._structure.Bind(wx.EVT_COMBOBOX, self._set_res)
        self._view_struct = metallicbutton.MetallicButton(self, 1, '', '', bitmaps.fetch_icon_bitmap('actions', 'viewmag', scale=(16,16)), size=(22, 20))
        self.Bind(wx.EVT_BUTTON, self._view_file, self._view_struct)
        
        self._struct_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self._struct_sizer.Add(self._view_struct, 0, wx.EXPAND|wx.RIGHT, 5)
        self._struct_sizer.Add(self._structure, 1, wx.EXPAND)
        
        self.input_sizer.Add(self._struct_sizer, 0, wx.EXPAND)

        self.input_sizer.Add(wx.StaticText(self, -1, 'Type'))
        self._refinement_type = wx.ComboBox(self, -1, REFINEMENT_TYPES[0], choices=REFINEMENT_TYPES, style=wx.CB_READONLY)
        self._refinement_type.Bind(wx.EVT_COMBOBOX, self._set_type)
        self.input_sizer.Add(self._refinement_type, 0, wx.EXPAND)

        self.input_sizer.Add(wx.StaticText(self, -1, 'Target'))
        self._target = wx.ComboBox(self, -1, REFINEMENT_TARGETS[0], choices=REFINEMENT_TARGETS, style=wx.CB_READONLY)
        self._target.Bind(wx.EVT_COMBOBOX, self._set_target)
        self.input_sizer.Add(self._target, 0, wx.EXPAND)
        
        self.input_sizer.Add(wx.StaticText(self, -1, 'Cycles'))
        self._cycles = wx.SpinCtrl(self, -1, value='10')
        self.input_sizer.Add(self._cycles, 0)
            
        self.input_sizer.Add(wx.StaticText(self, -1, 'Resolution'))
        self._res_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self._res_high = wx.TextCtrl(self, -1, '')
        self._res_low = wx.TextCtrl(self, -1, '')
        self._res_sizer.Add(self._res_high)
        self._res_sizer.Add(self._res_low)
        self.input_sizer.Add(self._res_sizer, 0)
            
        self.input_sizer.Add(wx.StaticText(self, -1, 'Options'))
        self._opt_sizer = wx.BoxSizer(wx.VERTICAL)

        self._auto = wx.CheckBox(self, -1, 'Auto Refinement', (10, 10))
        self._opt_sizer.Add(self._auto)
        self._auto.Bind(wx.EVT_CHECKBOX, self._set_auto)
        
        self._hydrogens = wx.CheckBox(self, -1, 'Add Hydrogens', (10, 10))
        self._opt_sizer.Add(self._hydrogens)

        self._anis = wx.CheckBox(self, -1, 'Anisotropic', (10, 10))
        self._opt_sizer.Add(self._anis)
        
        self._bloc = wx.CheckBox(self, -1, 'BLOC Refinement', (10, 10))
        self._opt_sizer.Add(self._bloc)
                             
        self._rfree = wx.CheckBox(self, -1, 'Include Rfree Set', (10, 10))
        self._opt_sizer.Add(self._rfree, 0)
        
        self.input_sizer.Add(self._opt_sizer, 0, wx.EXPAND)
        
        self._residues_title = wx.StaticText(self, -1, 'Unrestrained Residues')
        self._residues_title.Wrap(100)
        self.input_sizer.Add(self._residues_title)
        self._residues = wx.ListBox(self, 26, wx.DefaultPosition, (40, 100), [], wx.LB_MULTIPLE)

        self.input_sizer.Add(self._residues, 0, wx.EXPAND)
        
        self._ur_title = wx.StaticText(self, -1, 'Un-/Restrained Cycles')
        self._ur_title.Wrap(100)
        self._ur_cycles = wx.SpinCtrl(self, -1, value='5')
        self.input_sizer.Add(self._ur_title, 0, wx.EXPAND)
        self.input_sizer.Add(self._ur_cycles, 0)
        
        self._total_title = wx.StaticText(self, -1, 'Total Cycles')
        self._total_cycles = wx.SpinCtrl(self, -1, value='1')
        self.input_sizer.Add(self._total_title, 0, wx.EXPAND)
        self.input_sizer.Add(self._total_cycles, 0)
    
        self._custom_file = FileBrowser(self, 'Text File (*.txt)|*.txt', 'Select a text file containing custom shelx commands')
        self._custom_text = wx.TextCtrl(self, -1, '', style=wx.TE_MULTILINE, size=(-1, 100))
        
        self.input_sizer.Add(wx.StaticText(self, -1, 'Custom Commands'), 0, wx.EXPAND)
        
        self.custom_sizer = wx.BoxSizer(wx.VERTICAL)
        self.custom_sizer.Add(self._custom_file.sizer(), 0, wx.EXPAND)
        self.custom_sizer.Add(self._custom_text, 0, wx.EXPAND)
        
        self.input_sizer.Add(self.custom_sizer, 0, wx.EXPAND)
        
        self._button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self._startb = wx.Button(self, 0, 'Start')
        self._startb.Bind(wx.EVT_BUTTON, self._start)
        self._button_sizer.Add(self._startb, 1, wx.EXPAND|wx.ALL, 5)
        self._cancel = wx.Button(self, 1, 'Cancel')
        self._cancel.Bind(wx.EVT_BUTTON, self._close)
        self._button_sizer.Add(self._cancel, 1, wx.EXPAND|wx.ALL, 5)
        
        self.input_sizer.Add((10,10))
        self.input_sizer.Add(self._button_sizer, 0, wx.EXPAND)
        
        
        self.main_sizer = wx.BoxSizer(wx.VERTICAL)
        self.main_sizer.Add(self.input_sizer, 0, wx.EXPAND|wx.ALL, 5)
        #self.main_sizer.Add(self._button_sizer, 0, wx.EXPAND|wx.CENTER, 10)
        
        self.SetSizer(self.main_sizer)

        for c in [self._residues, self._residues_title, self._rfree, self._bloc, self._ur_title, self._ur_cycles, self._total_title, self._total_cycles]:
            c.Hide()

        self.Fit()
    
        if selected_refls in refls or selected_struct in inputs:
            if selected_refls in refls:
                self._reflections.SetStringSelection(selected_refls)
            if selected_struct in inputs:
                self._structure.SetStringSelection(selected_struct)
        else:
            self._hydrogens.SetValue(0)

        self._set_res('')

        if resh is not None:
            self._res_high.SetValue(str(resh))
Ejemplo n.º 26
0
    def __init__(self, nb):
        Tab.__init__(self, nb)

        self._pdbt = PDBTools()
        
        self._res_size = (200,170)
        self._to_save = []
        
        self.fig = Figure((5.0, 4.0), dpi=100)
        col = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND)
        self.fig.patch.set_facecolor((col[0]/255.0, col[1]/255.0, col[2]/255.0))
        self.canvas = FigCanvas(self, -1, self.fig)

        self.res = wx.StaticBitmap(self, size=self._res_size)
        self.res.SetBitmap(wx.EmptyImage(self._res_size[0], self._res_size[1]).ConvertToBitmap())

        self._rtypes = ['Aspartate', 'Glutamate', 'Histidine', 'Arginine']
        self._rtypess = ['Asp', 'Glu', 'His', 'Arg']
        
        self.ax1 = self.fig.add_subplot(111)
        self.ax1.set_position([0.10,0.153,0.80,0.81])
        #self.ax1.set_frame_on(False)
        [i.set_linewidth(0.5) for i in self.ax1.spines.itervalues()]
        self.ax2 = self.ax1.twinx()
        self.ax2.set_position([0.10,0.153,0.80,0.81])
        self.ax1.tick_params(labelsize=8)
        self.ax2.tick_params(labelsize=8)   
        
        self._highlight = -2
        
        self._bond_lengths = ''
        self._std_devs = ''
        self._residue_selection = []
        self._chain_lookup = {}
        
        self._residue_type = 0
        
        self._residues = {'asp': {}, 'glu': {}, 'his': {}, 'arg': {}}
        self._omitted = {'asp': [], 'glu': [], 'his': [], 'arg': []}
        
        self.omitted_title = wx.StaticBox( self, -1, "Omitted" ) 
        self.omitted_sizer = wx.StaticBoxSizer( self.omitted_title, wx.HORIZONTAL)        
        
        self.selected_title = wx.StaticBox( self, -1, "Displayed" ) 
        self.selected_sizer = wx.StaticBoxSizer( self.selected_title, wx.HORIZONTAL)        
        
        self.residue_info_title = wx.StaticBox( self, -1, "Residue Info: " ) 
        self.residue_info_sizer = wx.StaticBoxSizer( self.residue_info_title, wx.VERTICAL)
        
        #self.residue_info = wx.FlexGridSizer(rows=0, cols=2, vgap=5, hgap=5)
        
        #self.residue_info.Add(wx.StaticText(self, -1, 'D(C-O)'))
        #self._dco = wx.StaticText(self, -1, '')
        #self.residue_info.Add(self._dco)

        #self.residue_info.Add(wx.StaticText(self, -1, 'S(D(C-O))'))
        #self._sdco = wx.StaticText(self, -1, '')
        #self.residue_info.Add(self._sdco)
            
        #self.residue_info.Add(wx.StaticText(self, -1, 'Level'))
        #self._lev = wx.StaticText(self, -1, '')
        #self.residue_info.Add(self._lev)
        
        #self.residue_info_sizer.Add(self.residue_info, 0)
        self.residue_info_sizer.Add(self.res, 0)        
        
        self.residue_sel = wx.ListBox(self, 26, wx.DefaultPosition, (70, 80), [], wx.LB_MULTIPLE)
        self.residue_sel.Bind(wx.EVT_LISTBOX, self._update_sel)
        self.omitted_res = wx.ListBox(self, 26, wx.DefaultPosition, (70, 80), [], wx.LB_SINGLE)
        self.omitted_res.Bind(wx.EVT_LISTBOX, self._goto_omitted)

        self.data_box = wx.BoxSizer(wx.HORIZONTAL)
        self.data_box.Add(wx.StaticText(self, -1, 'Residue Type'), 0, wx.EXPAND|wx.ALL, 5)

        self.res_type = wx.ComboBox(self, -1, choices=[], style=wx.CB_READONLY)
        self.res_type.Bind(wx.EVT_COMBOBOX, self._set_residue_type)
        self.data_box.Add(self.res_type, 0, wx.EXPAND|wx.ALL, 5)

        self.omitted_sizer.Add(self.omitted_res, 1, wx.EXPAND|wx.ALL, 0)
        self.selected_sizer.Add(self.residue_sel, 1, wx.EXPAND|wx.ALL, 0)
                                                 
        self.ressel_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.ressel_sizer.Add(self.omitted_sizer, 1, wx.EXPAND|wx.ALL, 5)
        self.ressel_sizer.Add(self.selected_sizer, 1, wx.EXPAND|wx.ALL, 5)
        
        lig = metallicbutton.MetallicButton(self, -1, 'Ligands', '', bitmaps.fetch_icon_bitmap('actions', 'viewmag', scale=(16,16)), size=(75, 25))
        save = metallicbutton.MetallicButton(self, -1, 'Figure', '', bitmaps.fetch_icon_bitmap('actions', 'save_all', scale=(16,16)), size=(65, 25))
        tab = metallicbutton.MetallicButton(self, -1, 'Data', '', bitmaps.fetch_icon_bitmap('actions', 'save_all', scale=(16,16)), size=(65, 25))
        self.Bind(wx.EVT_BUTTON, self._view_ligands, lig)
        self.Bind(wx.EVT_BUTTON, self._save_figure, save)
        self.Bind(wx.EVT_BUTTON, self._save_data, tab)
        
        self.button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.button_sizer.Add(save, 0, wx.LEFT, 5)
        self.button_sizer.Add(tab, 0, wx.LEFT, 5)
        self.button_sizer.Add(lig, 0, wx.LEFT, 5)
        
        self.residue_box = wx.BoxSizer(wx.VERTICAL)
        self.residue_box.Add(self.data_box, 0)
        self.residue_box.Add(self.residue_info_sizer, 0, wx.EXPAND, 10)
        self.residue_box.Add(self.ressel_sizer, 0)
        self.residue_box.Add(self.button_sizer, 0)
        
        self.main = wx.BoxSizer(wx.HORIZONTAL)
        self.main.Add(self.residue_box, 1, wx.EXPAND|wx.ALL, 5)
        
        self.averages = wx.StaticText(self, -1, '', style=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
        self.bottom_sizer = wx.BoxSizer(wx.HORIZONTAL)
        #self.bottom_sizer.Add(self.button_sizer, 0)
        self.bottom_sizer.Add(self.averages, 1, wx.EXPAND)
        
        self.canvas_sizer = wx.BoxSizer(wx.VERTICAL)
        self.canvas_sizer.Add(self.canvas, 1, wx.EXPAND|wx.ALL)
        self.canvas_sizer.Add(self.bottom_sizer, 0, wx.EXPAND)
                
        self.main.Add(self.canvas_sizer, 3, wx.EXPAND|wx.ALL, 5)
        
        self.SetSizer(self.main)
        self.main.Fit(self)
        
        self.canvas.mpl_connect('button_press_event', self._on_click)
        self.canvas.mpl_connect('pick_event', self._show_series)
Ejemplo n.º 27
0
 btn2.AddSegment("Pan")
 btn2.AddSegment("Zoom")
 btn2.SetSelection(0)
 frame.Bind(wx.EVT_RADIOBUTTON, OnRadio, btn2)
 v_sizer.Add(wx.StaticText(panel, -1, "Radio buttons"), 0, wx.ALL, 5)
 v_sizer.Add(btn2, 0, wx.ALL, 5)
 btn3 = SegmentedToggleControl(panel)
 btn3.AddSegment("Maps")
 btn3.AddSegment("Models")
 btn3.AddSegment("Selection")
 btn3.Realize()
 frame.Bind(wx.EVT_TOGGLEBUTTON, OnToggle, btn3)
 v_sizer.Add(wx.StaticText(panel, -1, "Toggle buttons"), 0, wx.ALL, 5)
 v_sizer.Add(btn3, 0, wx.ALL, 5)
 if (bitmaps is not None) and (bitmaps.icon_lib is not None):
     bmp1 = bitmaps.fetch_icon_bitmap("actions", "1leftarrow", 16)
     bmp2 = bitmaps.fetch_icon_bitmap("actions", "gohome", 16)
     bmp3 = bitmaps.fetch_icon_bitmap("actions", "viewmag", 16)
     bmp4 = bitmaps.fetch_icon_bitmap("actions", "1rightarrow", 16)
     btn4 = SegmentedButtonControl(panel)
     btn4.AddSegment(bitmap=bmp1)
     btn4.AddSegment(bitmap=bmp2)
     btn4.AddSegment(bitmap=bmp3)
     btn4.AddSegment(bitmap=bmp4)
     v_sizer.Add(wx.StaticText(panel, -1, "Bitmap buttons"), 0, wx.ALL,
                 5)
     v_sizer.Add(btn4, 0, wx.ALL, 5)
     frame.Bind(wx.EVT_BUTTON, OnButton, btn4)
     btn5 = SegmentedButtonControl(panel, style=SEGBTN_ROUNDED_CORNERS)
     btn5.AddSegment(label="Back", bitmap=bmp1)
     btn5.AddSegment(label="Home", bitmap=bmp2)
Ejemplo n.º 28
0
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(1500, 600))
        self.parent = parent
        self.term_file = os.path.join(os.curdir, '.terminate_image_tracker')
        self.spf_backend = 'mosflm'

        self.reset_spotfinder()

        # Status bar
        self.sb = self.CreateStatusBar()
        self.sb.SetFieldsCount(2)
        self.sb.SetStatusWidths([100, -1])

        # Setup main sizer
        self.main_sizer = wx.BoxSizer(wx.VERTICAL)

        # Setup toolbar
        self.toolbar = self.CreateToolBar(style=wx.TB_3DBUTTONS | wx.TB_TEXT)
        quit_bmp = bitmaps.fetch_icon_bitmap('actions', 'exit')
        self.tb_btn_quit = self.toolbar.AddLabelTool(
            wx.ID_EXIT,
            label='Quit',
            bitmap=quit_bmp,
            shortHelp='Quit',
            longHelp='Quit image tracker')
        self.toolbar.AddSeparator()
        pref_bmp = bitmaps.fetch_icon_bitmap('apps', 'advancedsettings')
        self.tb_btn_prefs = self.toolbar.AddLabelTool(
            wx.ID_ANY,
            label='Preferences',
            bitmap=pref_bmp,
            shortHelp='Preferences',
            longHelp='IOTA image tracker preferences')
        self.toolbar.AddSeparator()
        open_bmp = bitmaps.fetch_icon_bitmap('actions', 'open')
        self.tb_btn_open = self.toolbar.AddLabelTool(wx.ID_ANY,
                                                     label='Open',
                                                     bitmap=open_bmp,
                                                     shortHelp='Open',
                                                     longHelp='Open folder')
        run_bmp = bitmaps.fetch_icon_bitmap('actions', 'run')
        self.tb_btn_run = self.toolbar.AddLabelTool(wx.ID_ANY,
                                                    label='Run',
                                                    bitmap=run_bmp,
                                                    shortHelp='Run',
                                                    longHelp='Run Spotfinding')
        stop_bmp = bitmaps.fetch_icon_bitmap('actions', 'stop')
        self.tb_btn_stop = self.toolbar.AddLabelTool(
            wx.ID_ANY,
            label='Stop',
            bitmap=stop_bmp,
            shortHelp='Stop',
            longHelp='Stop Spotfinding')
        self.toolbar.AddSeparator()
        span_view = bitmaps.fetch_custom_icon_bitmap('zoom_list')
        self.tb_btn_view = self.toolbar.AddLabelTool(
            wx.ID_ANY,
            label='View',
            bitmap=span_view,
            kind=wx.ITEM_RADIO,
            shortHelp='Select to View',
            longHelp='Select images to view')
        span_zoom = bitmaps.fetch_custom_icon_bitmap('zoom_view')
        self.tb_btn_zoom = self.toolbar.AddLabelTool(
            wx.ID_ANY,
            label='Zoom In',
            bitmap=span_zoom,
            kind=wx.ITEM_RADIO,
            shortHelp='Zoom In',
            longHelp='Zoom in on chart')
        self.toolbar.ToggleTool(self.tb_btn_zoom.GetId(), True)
        self.toolbar.EnableTool(self.tb_btn_run.GetId(), False)
        self.toolbar.EnableTool(self.tb_btn_stop.GetId(), False)
        self.toolbar.Realize()

        # Setup timers
        self.spf_timer = wx.Timer(self)
        self.uc_timer = wx.Timer(self)
        self.ff_timer = wx.Timer(self)

        self.tracker_panel = TrackerPanel(self)
        self.data_dict = self.tracker_panel.image_list.image_list.ctr.data.copy(
        )
        self.img_list_initialized = False

        self.main_sizer.Add(self.tracker_panel, 1, wx.EXPAND)

        # Generate default DIALS PHIL file
        default_phil = ip.parse(default_target)
        self.phil = phil_scope.fetch(source=default_phil)
        self.params = self.phil.extract()
        self.params.output.strong_filename = None
        self.phil = self.phil.format(python_object=self.params)

        # Bindings
        self.Bind(wx.EVT_TOOL, self.onQuit, self.tb_btn_quit)
        self.Bind(wx.EVT_TOOL, self.onGetImages, self.tb_btn_open)
        self.Bind(wx.EVT_TOOL, self.onRunSpotfinding, self.tb_btn_run)
        self.Bind(wx.EVT_TOOL, self.onStop, self.tb_btn_stop)
        self.Bind(wx.EVT_BUTTON, self.onSelView,
                  self.tracker_panel.btn_view_sel)
        self.Bind(wx.EVT_BUTTON, self.onWrtFile,
                  self.tracker_panel.btn_wrt_file)
        self.Bind(wx.EVT_BUTTON, self.onAllView,
                  self.tracker_panel.btn_view_all)
        self.Bind(wx.EVT_TOOL, self.onZoom, self.tb_btn_zoom)
        self.Bind(wx.EVT_TOOL, self.onList, self.tb_btn_view)

        # Spotfinder / timer bindings
        self.Bind(thr.EVT_SPFDONE, self.onSpfOneDone)
        self.Bind(thr.EVT_SPFALLDONE, self.onSpfAllDone)
        self.Bind(thr.EVT_SPFTERM, self.onSpfTerminated)
        self.Bind(wx.EVT_TIMER, self.onSpfTimer, id=self.spf_timer.GetId())
        self.Bind(wx.EVT_TIMER, self.onUCTimer, id=self.uc_timer.GetId())
        self.Bind(wx.EVT_TIMER, self.onPlotOnlyTimer, id=self.ff_timer.GetId())

        # Settings bindings
        #self.Bind(wx.EVT_BUTTON, self.onSpfOptions, self.tracker_panel.spf_options)
        self.Bind(wx.EVT_SPINCTRL, self.onMinBragg,
                  self.tracker_panel.min_bragg.ctr)
        self.Bind(wx.EVT_SPINCTRL, self.onChartRange,
                  self.tracker_panel.chart_window.ctr)

        # Read arguments if any
        self.args, self.phil_args = parse_command_args('').parse_known_args()

        self.spf_backend = self.args.backend
        self.tracker_panel.min_bragg.ctr.SetValue(self.args.bragg)

        if self.args.file is not None:
            self.results_file = self.args.file
            self.start_spotfinding(from_file=True)
        elif self.args.path is not None:
            path = os.path.abspath(self.args.path)
            self.open_images_and_get_ready(path=path)
            if self.args.start:
                print 'IMAGE_TRACKER: STARTING FROM FIRST RECORDED IMAGE'
                self.start_spotfinding()
            elif self.args.proceed:
                print 'IMAGE_TRACKER: STARTING FROM IMAGE RECORDED 1 MIN AGO'
                self.start_spotfinding(min_back=-1)
            elif self.args.time > 0:
                min_back = -self.args.time[0]
                print 'IMAGE_TRACKER: STARTING FROM IMAGE RECORDED {} MIN AGO' \
                      ''.format(min_back)
                self.start_spotfinding(min_back=min_back)
Ejemplo n.º 29
0
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(800, 500))

        # TODO: Allow GUI to be loaded with command line args, parse into PHIL
        self.iota_phil = inp.master_phil
        self.prefs_phil = None
        self.target_phil = None
        self.term_file = None

        # Create some defaults on startup
        # Figure out temp folder
        self.gparams = self.iota_phil.extract()
        tmp_folder = '/tmp/{}_{}'.format(user, pid)
        self.gparams.advanced.temporary_output_folder = tmp_folder

        self.iota_phil = self.iota_phil.format(python_object=self.gparams)

        # Menu bar
        menubar = wx.MenuBar()

        # Status bar
        self.sb = self.CreateStatusBar()

        # Help menu item with the about dialog
        m_help = wx.Menu()
        m_file = wx.Menu()
        self.mb_load_script = m_file.Append(wx.ID_OPEN, '&Load Script...')
        self.mb_save_script = m_file.Append(wx.ID_SAVE, '&Save Script...')
        m_file.AppendSeparator()
        self.mb_reset = m_file.Append(wx.ID_ANY, '&Reset Settings')
        self.mb_about = m_help.Append(wx.ID_ANY, '&About')
        menubar.Append(m_file, '&File')
        menubar.Append(m_help, '&Help')

        self.SetMenuBar(menubar)

        self.main_sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.main_sizer)

        # Toolbar
        self.toolbar = self.CreateToolBar(style=wx.TB_3DBUTTONS | wx.TB_TEXT)
        quit_bmp = bitmaps.fetch_icon_bitmap('actions', 'exit')
        self.tb_btn_quit = self.toolbar.AddLabelTool(wx.ID_EXIT,
                                                     label='Quit',
                                                     bitmap=quit_bmp,
                                                     shortHelp='Quit',
                                                     longHelp='Quit IOTA')
        pref_bmp = bitmaps.fetch_icon_bitmap('apps', 'advancedsettings')
        self.tb_btn_prefs = self.toolbar.AddLabelTool(
            wx.ID_ANY,
            label='Preferences',
            bitmap=pref_bmp,
            shortHelp='Preferences',
            longHelp='IOTA Preferences')
        self.toolbar.AddSeparator()
        load_bmp = bitmaps.fetch_icon_bitmap('actions', 'open')
        self.tb_btn_load = self.toolbar.AddLabelTool(
            wx.ID_ANY,
            label='Load Script',
            bitmap=load_bmp,
            shortHelp='Load Script',
            longHelp='Load IOTA Script')
        save_bmp = bitmaps.fetch_icon_bitmap('actions', 'save')
        self.tb_btn_save = self.toolbar.AddLabelTool(
            wx.ID_ANY,
            label='Save Script',
            bitmap=save_bmp,
            shortHelp='Save Script',
            longHelp='Save IOTA Script')
        reset_bmp = bitmaps.fetch_icon_bitmap('actions', 'reload')
        self.tb_btn_reset = self.toolbar.AddLabelTool(
            wx.ID_ANY,
            label='Reset',
            bitmap=reset_bmp,
            shortHelp='Reset Settings',
            longHelp='Reset IOTA settings with defaults')
        self.toolbar.AddSeparator()
        analyze_bmp = bitmaps.fetch_icon_bitmap('mimetypes',
                                                'text-x-generic-2')
        self.tb_btn_analysis = self.toolbar.AddLabelTool(
            wx.ID_ANY,
            label='Recover',
            bitmap=analyze_bmp,
            shortHelp='Recover',
            longHelp='Recover run, show statistics and restart if aborted ')
        run_bmp = bitmaps.fetch_icon_bitmap('actions', 'run')
        self.tb_btn_run = self.toolbar.AddLabelTool(
            wx.ID_ANY,
            label='Run',
            bitmap=run_bmp,
            shortHelp='Run',
            longHelp='Run all stages of refinement')

        # Test buttons for test windows - comment out when not needed
        # self.toolbar.AddSeparator()
        test_bmp = bitmaps.fetch_icon_bitmap('actions', 'utilities')
        self.tb_btn_test = self.toolbar.AddLabelTool(wx.ID_ANY,
                                                     label='Test',
                                                     bitmap=test_bmp)
        self.Bind(wx.EVT_TOOL, self.onRun, self.tb_btn_test)
        self.toolbar.RemoveTool(self.tb_btn_test.GetId())

        # These buttons will be disabled until input path is provided
        self.toolbar.EnableTool(self.tb_btn_run.GetId(), False)
        self.toolbar.Realize()

        # Instantiate windows
        self.input_window = frm.InputWindow(self, phil=self.iota_phil)

        # Single input window
        self.main_sizer.Add(self.input_window,
                            1,
                            flag=wx.ALL | wx.EXPAND,
                            border=10)
        self.main_sizer.Add((-1, 20))

        # button bindings
        self.Bind(wx.EVT_TOOL, self.onQuit, self.tb_btn_quit)
        self.Bind(wx.EVT_TOOL, self.onPreferences, self.tb_btn_prefs)
        self.Bind(wx.EVT_TOOL, self.onRun, self.tb_btn_run)
        self.Bind(wx.EVT_TOOL, self.onRecovery, self.tb_btn_analysis)
        self.Bind(wx.EVT_TOOL, self.onLoadScript, self.tb_btn_load)
        self.Bind(wx.EVT_TOOL, self.onOutputScript, self.tb_btn_save)
        self.Bind(wx.EVT_TOOL, self.onReset, self.tb_btn_reset)

        # Menubar button bindings
        self.Bind(wx.EVT_MENU, self.OnAboutBox, self.mb_about)
        self.Bind(wx.EVT_MENU, self.onOutputScript, self.mb_save_script)
        self.Bind(wx.EVT_MENU, self.onLoadScript, self.mb_load_script)
        self.Bind(wx.EVT_MENU, self.onReset, self.mb_reset)

        # Bindings to Input Window
        self.Bind(wx.EVT_BUTTON, self.onImportOptions,
                  self.input_window.opt_btn_import)
        self.Bind(wx.EVT_BUTTON, self.onProcessOptions,
                  self.input_window.opt_btn_process)
        self.Bind(wx.EVT_BUTTON, self.onAnalysisOptions,
                  self.input_window.opt_btn_analysis)

        # File list control bindings
        self.Bind(ulc.EVT_LIST_INSERT_ITEM, self.onItemInserted,
                  self.input_window.input)
Ejemplo n.º 30
0
 btn2.AddSegment("Pan")
 btn2.AddSegment("Zoom")
 btn2.SetSelection(0)
 frame.Bind(wx.EVT_RADIOBUTTON, OnRadio, btn2)
 v_sizer.Add(wx.StaticText(panel, -1, "Radio buttons"), 0, wx.ALL, 5)
 v_sizer.Add(btn2, 0, wx.ALL, 5)
 btn3 = SegmentedToggleControl(panel)
 btn3.AddSegment("Maps")
 btn3.AddSegment("Models")
 btn3.AddSegment("Selection")
 btn3.Realize()
 frame.Bind(wx.EVT_TOGGLEBUTTON, OnToggle, btn3)
 v_sizer.Add(wx.StaticText(panel, -1, "Toggle buttons"), 0, wx.ALL, 5)
 v_sizer.Add(btn3, 0, wx.ALL, 5)
 if (bitmaps is not None) and (bitmaps.icon_lib is not None):
     bmp1 = bitmaps.fetch_icon_bitmap("actions", "1leftarrow", 16)
     bmp2 = bitmaps.fetch_icon_bitmap("actions", "gohome", 16)
     bmp3 = bitmaps.fetch_icon_bitmap("actions", "viewmag", 16)
     bmp4 = bitmaps.fetch_icon_bitmap("actions", "1rightarrow", 16)
     btn4 = SegmentedButtonControl(panel)
     btn4.AddSegment(bitmap=bmp1)
     btn4.AddSegment(bitmap=bmp2)
     btn4.AddSegment(bitmap=bmp3)
     btn4.AddSegment(bitmap=bmp4)
     v_sizer.Add(wx.StaticText(panel, -1, "Bitmap buttons"), 0, wx.ALL, 5)
     v_sizer.Add(btn4, 0, wx.ALL, 5)
     frame.Bind(wx.EVT_BUTTON, OnButton, btn4)
     btn5 = SegmentedButtonControl(panel, style=SEGBTN_ROUNDED_CORNERS)
     btn5.AddSegment(label="Back", bitmap=bmp1)
     btn5.AddSegment(label="Home", bitmap=bmp2)
     btn5.AddSegment(label="Search", bitmap=bmp3)
    def __init__(self, parent, pparams, info):
        wx.Panel.__init__(self, parent)

        from prime.postrefine.mod_plotter import Plotter

        self.info = info
        self.pparams = pparams
        self.plot = Plotter(info=self.info,
                            anomalous_flag=self.pparams.target_anomalous_flag)

        self.summary_sizer = wx.BoxSizer(wx.VERTICAL)

        sfont = wx.Font(norm_font_size, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
        bfont = wx.Font(norm_font_size, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.SetFont(bfont)

        # Run information
        run_box = wx.StaticBox(self, label='Run Information')
        run_box.SetFont(sfont)
        run_box_sizer = wx.StaticBoxSizer(run_box, wx.VERTICAL)
        run_box_grid = wx.FlexGridSizer(3, 2, 5, 20)
        self.title_txt = wx.StaticText(self, label='')
        self.title_txt.SetFont(sfont)
        self.folder_txt = wx.StaticText(self, label='')
        self.folder_txt.SetFont(sfont)

        run_box_grid.AddMany([(wx.StaticText(self, label='Title')),
                              (self.title_txt, 1, wx.EXPAND),
                              (wx.StaticText(self, label='Directory')),
                              (self.folder_txt, 1, wx.EXPAND)])

        run_box_grid.AddGrowableCol(1, 1)
        run_box_sizer.Add(run_box_grid, flag=wx.EXPAND | wx.ALL, border=10)
        self.summary_sizer.Add(run_box_sizer,
                               flag=wx.EXPAND | wx.ALL,
                               border=10)

        # Table 1
        tb1_box = wx.StaticBox(self, label='Merging Statistics')
        tb1_box.SetFont(sfont)
        tb1_box_sizer = wx.StaticBoxSizer(tb1_box, wx.HORIZONTAL)

        self.tb1_labels, self.tb1_data = self.plot.table_one()
        self.tb1 = ct.TableCtrl(self,
                                rlabels=self.tb1_labels,
                                contents=self.tb1_data,
                                label_style='bold')

        # Buttons (placeholder for now)
        btn_box_sizer = wx.BoxSizer(wx.VERTICAL)
        line_bmp = bitmaps.fetch_custom_icon_bitmap('line_graph24')
        self.btn_stats = ct.GradButton(self,
                                       bmp=line_bmp,
                                       label=' Statistical charts',
                                       size=(250, -1))
        txt_bmp = bitmaps.fetch_icon_bitmap('mimetypes', 'txt', scale=(24, 24))
        self.btn_table1 = ct.GradButton(self,
                                        bmp=txt_bmp,
                                        label=' Output Table 1',
                                        size=(250, -1))
        btn_box_sizer.Add(self.btn_stats)
        self.Bind(wx.EVT_BUTTON, self.onPlotStats, self.btn_stats)
        btn_box_sizer.Add(self.btn_table1, flag=wx.TOP, border=5)
        self.Bind(wx.EVT_BUTTON, self.onWriteTableOne, self.btn_table1)

        tb1_box_sizer.Add(self.tb1, flag=wx.EXPAND | wx.ALL, border=10)
        tb1_box_sizer.AddStretchSpacer()
        tb1_box_sizer.Add(btn_box_sizer,
                          flag=wx.ALIGN_RIGHT | wx.ALL,
                          border=10)
        self.summary_sizer.Add(tb1_box_sizer,
                               flag=wx.EXPAND | wx.ALL,
                               border=10)

        self.SetSizer(self.summary_sizer)
Ejemplo n.º 32
0
  def __init__(self, parent, id, title, phil=None, prefix='prime'):
    wx.Frame.__init__(self, parent, id, title, size=(800, 500))

    self.prime_filename = '{}.phil'.format(prefix)

    # Toolbar
    self.toolbar = self.CreateToolBar(wx.TB_TEXT)
    quit_bmp = bitmaps.fetch_icon_bitmap('actions', 'exit')
    self.tb_btn_quit = self.toolbar.AddLabelTool(wx.ID_EXIT, label='Quit',
                                                 bitmap=quit_bmp,
                                                 shortHelp='Quit',
                                                 longHelp='Exit PRIME')
    pref_bmp = bitmaps.fetch_icon_bitmap('apps', 'advancedsettings')
    self.tb_btn_prefs = self.toolbar.AddLabelTool(wx.ID_ANY,
                                                  label='Preferences',
                                                  bitmap=pref_bmp,
                                                  shortHelp='Preferences',
                                                  longHelp='PRIME Preferences')
    self.toolbar.AddSeparator()
    load_bmp = bitmaps.fetch_icon_bitmap('actions', 'open')
    self.tb_btn_load = self.toolbar.AddLabelTool(wx.ID_ANY,
                                                 label='Load Script',
                                                 bitmap=load_bmp,
                                                 shortHelp='Load Script',
                                                 longHelp='Load PRIME Script')
    save_bmp = bitmaps.fetch_icon_bitmap('actions', 'save')
    self.tb_btn_save = self.toolbar.AddLabelTool(wx.ID_ANY,
                                                 label='Save Script',
                                                 bitmap=save_bmp,
                                                 shortHelp='Save Script',
                                                 longHelp='Save PRIME Script')
    reset_bmp = bitmaps.fetch_icon_bitmap('actions', 'reload')
    self.tb_btn_reset = self.toolbar.AddLabelTool(wx.ID_ANY,
                                                  label='Reset',
                                                  bitmap=reset_bmp,
                                                  shortHelp='Reset Settings',
                                                  longHelp='Reset PRIME settings with defaults')
    self.toolbar.AddSeparator()
    analyze_bmp = bitmaps.fetch_icon_bitmap('mimetypes', 'text-x-generic-2')
    self.tb_btn_analysis = self.toolbar.AddLabelTool(wx.ID_ANY, label='Recover',
                                                     bitmap=analyze_bmp,
                                                     shortHelp='Recover',
                                                     longHelp='Show past results')
    run_bmp = bitmaps.fetch_icon_bitmap('actions', 'run')
    self.tb_btn_run = self.toolbar.AddLabelTool(wx.ID_ANY, label='Run',
                                                bitmap=run_bmp,
                                                shortHelp='Run',
                                                longHelp='Run scaling, merging and post-refinement with PRIME')
    # These buttons will be disabled until input path is provided
    self.toolbar.EnableTool(self.tb_btn_run.GetId(), False)
    self.toolbar.Realize()

    # Status bar
    self.sb = self.CreateStatusBar()
    self.sb.SetFieldsCount(3)
    self.sb.SetStatusWidths([320, 200, -2])

    # Menu bar
    menubar = wx.MenuBar()
    m_help = wx.Menu()
    m_file = wx.Menu()
    self.mb_load_script = m_file.Append(wx.ID_OPEN, '&Load Script...')
    self.mb_save_script = m_file.Append(wx.ID_SAVE, '&Save Script...')
    self.mb_about = m_help.Append(wx.ID_ANY, '&About')
    menubar.Append(m_file, '&File')
    menubar.Append(m_help, '&Help')
    self.SetMenuBar(menubar)

    # Place elements in main PRIME window
    main_box = wx.BoxSizer(wx.VERTICAL)

    # Instantiate windows
    self.input_window = frm.PRIMEInputWindow(self, phil=phil)

    # Single input window
    main_box.Add(self.input_window, 1, flag=wx.ALL | wx.EXPAND, border=10)
    main_box.Add((-1, 20))

    # Menubar button bindings
    self.Bind(wx.EVT_MENU, self.OnAboutBox, self.mb_about)
    self.Bind(wx.EVT_MENU, self.onSaveScript, self.mb_save_script)
    self.Bind(wx.EVT_MENU, self.onLoadScript, self.mb_load_script)

    # Toolbar button bindings
    self.Bind(wx.EVT_TOOL, self.onQuit, self.tb_btn_quit)
    self.Bind(wx.EVT_TOOL, self.onPreferences, self.tb_btn_prefs)
    self.Bind(wx.EVT_TOOL, self.onRecovery, self.tb_btn_analysis)
    self.Bind(wx.EVT_TOOL, self.onRun, self.tb_btn_run)
    self.Bind(wx.EVT_TOOL, self.onLoadScript, self.tb_btn_load)
    self.Bind(wx.EVT_TOOL, self.onSaveScript, self.tb_btn_save)
    self.Bind(wx.EVT_TOOL, self.onReset, self.tb_btn_reset)

    # Draw the main window sizer
    self.SetSizer(main_box)
    def __init__(self,
                 parent,
                 id,
                 title,
                 params,
                 prime_file,
                 mp_method='python',
                 command=None,
                 recover=False):
        wx.Frame.__init__(self,
                          parent,
                          id,
                          title,
                          size=(800, 900),
                          style=wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX
                          | wx.RESIZE_BORDER)

        self.logtext = ''
        self.pparams = params
        self.prime_file = prime_file
        self.out_file = os.path.join(self.pparams.run_no, 'log.txt')
        self.bookmark = 0
        self.prev_pids = []
        self.aborted = False
        self.command = command
        self.mp_method = mp_method
        self.current_cycle = -1

        self.main_panel = wx.Panel(self)
        self.main_sizer = wx.BoxSizer(wx.VERTICAL)

        # Toolbar
        self.prime_toolbar = self.CreateToolBar(wx.TB_TEXT)
        abort_bmp = bitmaps.fetch_icon_bitmap('actions', 'stop')
        self.tb_btn_abort = self.prime_toolbar.AddLabelTool(wx.ID_ANY,
                                                            label='Abort',
                                                            bitmap=abort_bmp,
                                                            shortHelp='Abort')
        self.prime_toolbar.Realize()

        # Status box
        self.status_panel = wx.Panel(self.main_panel)
        self.status_sizer = wx.BoxSizer(wx.VERTICAL)
        self.status_box = wx.StaticBox(self.status_panel, label='Status')
        self.status_box_sizer = wx.StaticBoxSizer(self.status_box,
                                                  wx.HORIZONTAL)
        self.status_txt = wx.StaticText(self.status_panel, label='')
        self.status_box_sizer.Add(self.status_txt,
                                  flag=wx.ALL | wx.ALIGN_CENTER,
                                  border=10)
        self.status_sizer.Add(self.status_box_sizer,
                              flag=wx.EXPAND | wx.ALL,
                              border=3)
        self.status_panel.SetSizer(self.status_sizer)

        # Tabbed output window(s)
        self.prime_panel = wx.Panel(self.main_panel)
        self.prime_nb = wx.Notebook(self.prime_panel, style=0)
        self.log_tab = LogTab(self.prime_nb)
        self.graph_tab = RuntimeTab(self.prime_nb, params=self.pparams)
        self.prime_nb.AddPage(self.log_tab, 'Log')
        self.prime_nb.AddPage(self.graph_tab, 'Charts')
        self.prime_nb.SetSelection(1)
        self.prime_sizer = wx.BoxSizer(wx.VERTICAL)
        self.prime_sizer.Add(self.prime_nb,
                             1,
                             flag=wx.EXPAND | wx.ALL,
                             border=3)
        self.prime_panel.SetSizer(self.prime_sizer)

        self.main_sizer.Add(self.status_panel,
                            flag=wx.EXPAND | wx.ALL,
                            border=3)
        self.main_sizer.Add(self.prime_panel,
                            1,
                            flag=wx.EXPAND | wx.ALL,
                            border=3)
        self.main_panel.SetSizer(self.main_sizer)

        #Processing status bar
        self.sb = self.CreateStatusBar()
        self.sb.SetFieldsCount(2)
        self.sb.SetStatusWidths([-1, -2])

        # Output gauge in status bar
        self.gauge_prime = wx.Gauge(self.sb,
                                    -1,
                                    style=wx.GA_HORIZONTAL | wx.GA_SMOOTH)
        rect = self.sb.GetFieldRect(0)
        self.gauge_prime.SetPosition((rect.x + 2, rect.y + 2))
        self.gauge_prime.SetSize((rect.width - 4, rect.height - 4))
        self.gauge_prime.Hide()

        # Output polling timer
        self.timer = wx.Timer(self)

        # Event bindings
        self.Bind(thr.EVT_ALLDONE, self.onFinishedProcess)
        self.sb.Bind(wx.EVT_SIZE, self.onStatusBarResize)
        self.Bind(wx.EVT_TIMER, self.onTimer, id=self.timer.GetId())

        # Button bindings
        self.Bind(wx.EVT_TOOL, self.onAbort, self.tb_btn_abort)

        if not recover:
            self.run()
Ejemplo n.º 34
0
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(1500, 600))
        self.parent = parent
        self.term_file = os.path.join(os.curdir, '.terminate_image_tracker')
        self.spf_backend = 'mosflm'
        self.run_indexing = False
        self.run_integration = False
        self.running_clustering = False

        # Status bar
        self.sb = self.CreateStatusBar()
        self.sb.SetFieldsCount(2)
        self.sb.SetStatusWidths([100, -1])

        # Setup main sizer
        self.main_sizer = wx.BoxSizer(wx.VERTICAL)

        # Setup toolbar
        self.toolbar = self.CreateToolBar(style=wx.TB_3DBUTTONS | wx.TB_TEXT)
        quit_bmp = bitmaps.fetch_icon_bitmap('actions', 'exit')
        self.tb_btn_quit = self.toolbar.AddLabelTool(
            wx.ID_EXIT,
            label='Quit',
            bitmap=quit_bmp,
            shortHelp='Quit',
            longHelp='Quit image tracker')
        self.toolbar.AddSeparator()
        # pref_bmp = bitmaps.fetch_icon_bitmap('apps', 'advancedsettings')
        # self.tb_btn_prefs = self.toolbar.AddLabelTool(wx.ID_ANY,
        #                                               label='Preferences',
        #                                               bitmap=pref_bmp,
        #                                               shortHelp='Preferences',
        #                                               longHelp='IOTA image tracker preferences')
        # self.toolbar.AddSeparator()
        open_bmp = bitmaps.fetch_icon_bitmap('actions', 'open')
        self.tb_btn_open = self.toolbar.AddLabelTool(wx.ID_ANY,
                                                     label='Open',
                                                     bitmap=open_bmp,
                                                     shortHelp='Open',
                                                     longHelp='Open folder')
        run_bmp = bitmaps.fetch_icon_bitmap('actions', 'run')
        self.tb_btn_run = self.toolbar.AddLabelTool(wx.ID_ANY,
                                                    label='Run',
                                                    bitmap=run_bmp,
                                                    shortHelp='Run',
                                                    longHelp='Run Spotfinding')
        stop_bmp = bitmaps.fetch_icon_bitmap('actions', 'stop')
        self.tb_btn_stop = self.toolbar.AddLabelTool(
            wx.ID_ANY,
            label='Stop',
            bitmap=stop_bmp,
            shortHelp='Stop',
            longHelp='Stop Spotfinding')
        self.toolbar.AddSeparator()
        span_view = bitmaps.fetch_custom_icon_bitmap('zoom_list')
        self.tb_btn_view = self.toolbar.AddLabelTool(
            wx.ID_ANY,
            label='View',
            bitmap=span_view,
            kind=wx.ITEM_RADIO,
            shortHelp='Select to View',
            longHelp='Select images to view')
        span_zoom = bitmaps.fetch_custom_icon_bitmap('zoom_view')
        self.tb_btn_zoom = self.toolbar.AddLabelTool(
            wx.ID_ANY,
            label='Zoom In',
            bitmap=span_zoom,
            kind=wx.ITEM_RADIO,
            shortHelp='Zoom In',
            longHelp='Zoom in on chart')
        self.toolbar.ToggleTool(self.tb_btn_zoom.GetId(), True)
        self.toolbar.EnableTool(self.tb_btn_run.GetId(), False)
        self.toolbar.EnableTool(self.tb_btn_stop.GetId(), False)
        self.toolbar.Realize()

        # Setup timers
        self.spf_timer = wx.Timer(self)
        self.uc_timer = wx.Timer(self)
        self.ff_timer = wx.Timer(self)

        self.tracker_panel = TrackerPanel(self)
        self.data_dict = self.tracker_panel.image_list.image_list.ctr.data.copy(
        )
        self.img_list_initialized = False

        self.main_sizer.Add(self.tracker_panel, 1, wx.EXPAND)

        # Bindings
        self.Bind(wx.EVT_TOOL, self.onQuit, self.tb_btn_quit)
        self.Bind(wx.EVT_TOOL, self.onGetImages, self.tb_btn_open)
        self.Bind(wx.EVT_TOOL, self.onRunSpotfinding, self.tb_btn_run)
        self.Bind(wx.EVT_TOOL, self.onStop, self.tb_btn_stop)
        self.Bind(wx.EVT_BUTTON, self.onSelView,
                  self.tracker_panel.btn_view_sel)
        self.Bind(wx.EVT_BUTTON, self.onWrtFile,
                  self.tracker_panel.btn_wrt_file)
        self.Bind(wx.EVT_BUTTON, self.onAllView,
                  self.tracker_panel.btn_view_all)
        self.Bind(wx.EVT_TOOL, self.onZoom, self.tb_btn_zoom)
        self.Bind(wx.EVT_TOOL, self.onList, self.tb_btn_view)

        # Spotfinder / timer bindings
        self.Bind(thr.EVT_SPFDONE, self.onSpfOneDone)

        # Settings bindings
        self.Bind(wx.EVT_SPINCTRL, self.onMinBragg,
                  self.tracker_panel.min_bragg.ctr)
        self.Bind(wx.EVT_SPINCTRL, self.onChartRange,
                  self.tracker_panel.chart_window.ctr)
        self.Bind(wx.EVT_CHECKBOX, self.onChartRange,
                  self.tracker_panel.chart_window.toggle)

        # Initialize tracker
        self.initialize_spotfinder()
Ejemplo n.º 35
0
    def __init__(self, *args, **kwds):
        from wxtbx import bitmaps

        super().__init__(*args, **kwds)

        # Needed for communication with the root frame.
        self._root_frame = self.GetParent().GetParent()

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(sizer)

        self._id_text = wx.NewId()
        text = wx.StaticText(self, id=self._id_text, label="")
        sizer.Add(text, flag=wx.ALIGN_CENTER)

        # The score buttons.  XXX Would really like this to be stars or
        # some such.  Could then zap the static text above.
        box = wx.BoxSizer(wx.HORIZONTAL)
        self._id_buttons = []
        for i in range(6):
            btn = wx.Button(self, label="%d" % i)
            box.Add(btn, flag=wx.ALIGN_CENTER, border=5)
            self.Bind(wx.EVT_BUTTON, self.OnScore, btn)
            self._id_buttons.append(btn.GetId())
        sizer.Add(box)

        # XXX Would like to have label and short help for the buttons.
        # Buttons in wxWidgets version 2.9.1 and later support text and
        # bitmap, see SetBitmap, SetBitmapLabel, SetBitmapDisabled, etc.
        box = wx.BoxSizer(wx.HORIZONTAL)

        self._id_previous = wx.NewId()
        btn = wx.BitmapButton(
            self,
            id=self._id_previous,
            bitmap=bitmaps.fetch_icon_bitmap("actions", "1leftarrow"),
            style=wx.BORDER_NONE,
        )
        box.Add(btn, flag=wx.ALIGN_CENTER, border=5)
        self.Bind(wx.EVT_BUTTON, self.OnPrevious, btn)

        btn = wx.Button(self, label="Save scores")
        box.Add(btn, flag=wx.ALIGN_CENTER, border=5)
        self.Bind(wx.EVT_BUTTON, self.OnSave, btn)

        self._id_next = wx.NewId()
        btn = wx.BitmapButton(
            self,
            id=self._id_next,
            bitmap=bitmaps.fetch_icon_bitmap("actions", "1rightarrow"),
            style=wx.BORDER_NONE,
        )
        box.Add(btn, flag=wx.ALIGN_CENTER, border=5)
        self.Bind(wx.EVT_BUTTON, self.OnNext, btn)

        sizer.Add(box, flag=wx.ALIGN_CENTER)

        # Register update events for the dynamic widgets.
        self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateNext, id=self._id_next)
        self.Bind(wx.EVT_UPDATE_UI,
                  self.OnUpdatePrevious,
                  id=self._id_previous)
        self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateText, id=self._id_text)

        for i in range(self._root_frame.image_chooser.GetCount()):
            _scores[self._root_frame.get_key(
                self._root_frame.image_chooser.GetClientData(i))] = None
Ejemplo n.º 36
0
    def __init__(self, job, title, root):
        wx.Frame.__init__(self,None,-1,'Job Summary', size=(500,300))
        
        self.toolbar = wx.ToolBar(self, style=wx.TB_3DBUTTONS|wx.TB_TEXT)
        close = self.toolbar.AddLabelTool(wx.ID_ANY, 'Close', bitmaps.fetch_icon_bitmap("actions", "no"))
        self.Bind(wx.EVT_TOOL, self._close, close)
        self.toolbar.AddSeparator()
        self.toolbar.AddControl(wx.StaticText(self.toolbar, -1, title))
        self.SetToolBar(self.toolbar)
        self.toolbar.Realize()
        
        self.table = wx.FlexGridSizer(cols=2, rows=0, hgap=5, vgap=5)
        
        if os.path.exists(job):
            r = pickle.load(open(job, 'rb'))
            p = r.parameters()
            
            #self.table.Add(wx.StaticText(self, -1, 'Job:'))
            #self.table.Add(wx.StaticText(self, -1, title))
            self.table.Add(wx.StaticText(self, -1, 'Title:'))
            self.table.Add(wx.StaticText(self, -1, p['title']), 0, wx.EXPAND|wx.BOTTOM, 10)
            
            self.table.Add(wx.StaticText(self, -1, 'Started:'))
            self.table.Add(wx.StaticText(self, -1, time.strftime("%H:%M %d-%m-%Y", time.localtime(p['time']))))
            self.table.Add(wx.StaticText(self, -1, 'Time Taken:'))
            self.table.Add(wx.StaticText(self, -1, str(round((p['timef']-p['time'])/60,1)) + ' mins'), 0, wx.EXPAND|wx.BOTTOM, 10)
            
            self.table.Add(wx.StaticText(self, -1, 'Input HKL:'))
            self.table.Add(wx.StaticText(self, -1, p['hkl'].replace(root, '')))
            self.table.Add(wx.StaticText(self, -1, 'Input INS:'))
            self.table.Add(wx.StaticText(self, -1, p['ins'].replace(root, '')), 0, wx.EXPAND|wx.BOTTOM, 10)
            
            self.table.Add(wx.StaticText(self, -1, 'Status:'))
            self.table.Add(wx.StaticText(self, -1, p['status']))
            self.table.Add(wx.StaticText(self, -1, 'Type:'))
            self.table.Add(wx.StaticText(self, -1, REFINEMENT_TYPES[p['type']]))

            self.table.Add(wx.StaticText(self, -1, 'Target:'))
            self.table.Add(wx.StaticText(self, -1, REFINEMENT_TARGETS[p['target']] if 'target' in  p else 'Unknown'))
            
            if p['type'] == PART_UNRESTRAINED:
                self.table.Add(wx.StaticText(self, -1, 'Unrestrained Residues:'))
                self.table.Add(wx.StaticText(self, -1, ', '.join(p['options']['residues'])), 0, wx.EXPAND|wx.BOTTOM, 10)
            
            if p['type'] == FULL_MATRIX:
                self.table.Add(wx.StaticText(self, -1, 'BLOC 1:'))
                self.table.Add(wx.StaticText(self, -1, 'Yes' if p['options']['bloc'] else 'No'))
                self.table.Add(wx.StaticText(self, -1, 'Include Rfree:'))
                self.table.Add(wx.StaticText(self, -1, 'Yes' if p['options']['rfree'] else 'No'), 0, wx.EXPAND|wx.BOTTOM, 10)
            
            self.table.Add(wx.StaticText(self, -1, 'Cycles:'))
            self.table.Add(wx.StaticText(self, -1, str(p['total_cycles'])))
            self.table.Add(wx.StaticText(self, -1, 'Resolution'))
            self.table.Add(wx.StaticText(self, -1, '%.2f - %.2f' % (p['res'], p['resl'])))
            
            self.table.Add(wx.StaticText(self, -1, 'R:'))
            self.table.Add(wx.StaticText(self, -1, '-' if p['r'] == -1 else (p['r'] if type(p['r']) == type(str()) else '%.4f' % p['r'])))
            self.table.Add(wx.StaticText(self, -1, 'Rfree:'))
            self.table.Add(wx.StaticText(self, -1, '-' if p['rfree'] == -1 else '%.4f' % p['rfree']), 0, wx.EXPAND|wx.BOTTOM, 10)
            
            self.table.Add(wx.StaticText(self, -1, 'Hydrogens:'))
            self.table.Add(wx.StaticText(self, -1,'Yes' if p['options']['hydrogens'] else 'No'))
            self.table.Add(wx.StaticText(self, -1, 'Anistropic:'))
            self.table.Add(wx.StaticText(self, -1,'Yes' if p['options']['anis'] else 'No'))

            self.table.Add(wx.StaticText(self, -1, 'Custom Commands:'))
        
            cust = ''
            if 'custom' in p['options']:
                if p['options']['custom']:
                    cust = p['options']['custom']
        
            if 'custom_text' in p['options']:
                if p['options']['custom_text']:
                    if cust:
                        cust += "\n"
                    cust += p['options']['custom_text']
                    
        
            if not cust:
                cust = 'N/A'
                        
            self.table.Add(wx.StaticText(self, -1, cust))
        
        self.fig = Figure((3.0, 2.0), dpi=100)
        col = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND)
        self.fig.patch.set_facecolor((col[0]/255.0, col[1]/255.0, col[2]/255.0))
        self.canvas = FigCanvas(self, -1, self.fig)
        self.ax1 = self.fig.add_subplot(111)
        self.ax2 = self.ax1.twinx()
        
        self.ax1.set_ylabel('wR2', fontsize=9)
        self.ax1.tick_params(labelsize=8)
        self.ax1.yaxis.set_major_formatter(FormatStrFormatter('%5.3f'))
        
        self.ax2.tick_params(labelsize=8)
        self.ax2.yaxis.set_major_formatter(FormatStrFormatter('%4.1f'))
        
        self.ax2.set_ylabel('GooF', fontsize=9)
        
        x  = range(len(p['cycles'].keys()))
        y  = [ p['cycles'][i+1][0] for i in x ]
        y2 = [ p['cycles'][i+1][1] for i in x ]
        
        self.ax1.plot(x, y, 'r^-')
        self.ax2.plot(x,y2, 'bo-')
        
        self.ax1.set_xticks(x)
        self.ax1.set_xticklabels([ str(i+1) for i in x ], rotation='vertical', size=8)
        
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.table, 0, wx.EXPAND|wx.ALL, 5)
        self.sizer.Add(self.canvas, 0, wx.EXPAND|wx.ALL, 5)
        
        self.SetSizer(self.sizer)
        self.Fit()