Пример #1
0
	def __register_interests(self):
		# wxPython events
		wx.EVT_SIZE(self, self.OnSize)
		wx.EVT_LISTBOX(self, self.ID_VaccinatedIndicationsList, self._on_vaccinated_indication_selected)
		wx.EVT_LISTBOX_DCLICK(self, self.ID_VaccinationsPerRegimeList, self._on_given_shot_selected)
		wx.EVT_LISTBOX_DCLICK(self, self.ID_MissingShots, self._on_missing_shot_selected)
#		wx.EVT_RIGHT_UP(self.lb1, self.EvtRightButton)

		# client internal signals
		gmDispatcher.connect(signal= 'post_patient_selection', receiver=self._schedule_data_reget)
		gmDispatcher.connect(signal= 'vaccinations_updated', receiver=self._schedule_data_reget)
Пример #2
0
    def __do_events(self):
    
    	wx.EVT_CLOSE(self, self.OnClose)

    	wx.EVT_BUTTON(self, self.button_channel_join.GetId(), self.OnJoinClick)
    	wx.EVT_LISTBOX_DCLICK(self, self.list_channel_channels.GetId(), self.OnJoinDoubleClick)
    	wx.EVT_LISTBOX(self, self.list_channel_channels.GetId(), self.OnListSelect)
Пример #3
0
    def createLayout(self):
        self.listbox = wx.ListBox(self, ID_LISTBOX, wx.DefaultPosition,
                                  wx.DefaultSize, [],
                                  wx.LB_SINGLE | wx.LB_SORT,
                                  wx.DefaultValidator)
        self.listbox.typedText = ""

        try:
            s = self.pcsc.listAllReaders()
        except:
            print_exc()
        for i in s.split("\t"):
            if i:
                self.listbox.Append(i)

        self.bOK = wx.Button(self, ID_BUTTON_OK, "OK")
        self.bCancel = wx.Button(self, ID_BUTTON_CANCEL, "Cancel")

        self.sizer1 = wx.BoxSizer(wx.VERTICAL)
        self.sizer2 = wx.BoxSizer(wx.HORIZONTAL)
        self.sizer2.Add(self.bOK, 1, wx.EXPAND | wx.ALL, 10)
        self.sizer2.Add(self.bCancel, 1, wx.EXPAND | wx.ALL, 10)
        self.sizer1.Add(self.listbox, 1, wx.EXPAND | wx.ALL, 20)
        self.sizer1.Add(self.sizer2)
        self.SetSizer(self.sizer1)
        self.SetAutoLayout(1)
        self.sizer1.Fit(self)

        wx.EVT_LISTBOX_DCLICK(self, ID_LISTBOX, self.selectNewReaderOK)
        wx.EVT_BUTTON(self, ID_BUTTON_OK, self.selectNewReaderOK)
        wx.EVT_BUTTON(self, ID_BUTTON_CANCEL, self.selectNewReaderCancel)
Пример #4
0
    def _create_listbox(self, parent, sizer, handler1, handler2, title):
        """ Creates a list box.
        """
        column_sizer = wx.BoxSizer(wx.VERTICAL)

        # Add the column title in emphasized text:
        title_widget = wx.StaticText(parent, -1, title)
        font = title_widget.GetFont()
        emphasis_font = wx.Font(font.GetPointSize() + 1, font.GetFamily(),
                                font.GetStyle(), wx.BOLD)
        title_widget.SetFont(emphasis_font)
        column_sizer.Add(title_widget, 0, 0)

        # Create the list box and add it to the column:
        list = wx.ListBox(parent, -1, style=wx.LB_EXTENDED | wx.LB_NEEDED_SB)
        column_sizer.Add(list, 1, wx.EXPAND)

        # Add the column to the SetEditor widget:
        sizer.Add(column_sizer, 1, wx.EXPAND)

        # Hook up the event handlers:
        wx.EVT_LISTBOX(parent, list.GetId(), handler1)
        wx.EVT_LISTBOX_DCLICK(parent, list.GetId(), handler2)

        return list
Пример #5
0
    def __init__(self, parent, message, database):
        super(SelectURLDialog, self).__init__(parent, -1, 'URL Selection')
        self._db = database
        self._data = []
        vbs = wx.BoxSizer(wx.VERTICAL)
        vbs.Add(wx.StaticText(self, -1, message), 0, wx.EXPAND | wx.ALL, 5)
        self._choices = wx.ListBox(self,
                                   -1,
                                   style=wx.LB_SINGLE | wx.LB_HSCROLL
                                   | wx.LB_NEEDED_SB)
        wx.EVT_LISTBOX_DCLICK(self, self._choices.GetId(), self.OnOK)
        vbs.Add(self._choices, 0, wx.EXPAND | wx.ALL, 5)
        vbs.Add(wx.StaticLine(self), 0, wx.EXPAND | wx.ALL, 5)
        hbs = self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL)
        _btn = wx.Button(self, -1, 'New')
        wx.EVT_BUTTON(self, _btn.GetId(), self.OnNew)
        hbs.Add(_btn, 0, wx.EXPAND | wx.ALL, 5)
        _btn = wx.Button(self, -1, 'Delete')
        wx.EVT_BUTTON(self, _btn.GetId(), self.OnDel)
        hbs.Add(_btn, 0, wx.EXPAND | wx.ALL, 5)
        vbs.Add(hbs, 0, wx.EXPAND | wx.ALL, 5)

        self._get_from_fs()
        self.SetSizer(vbs)
        self.SetAutoLayout(True)
        vbs.Fit(self)
Пример #6
0
 def __init__(self, parent=None, id=-1, title="Checking Spelling..."):
     wx.Dialog.__init__(
         self,
         parent,
         id,
         title,
         size=wxSpellCheckerDialog.sz,
         style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
     )
     self._numContext = 40
     self._checker = None
     self._buttonsEnabled = True
     self.error_text = wx.TextCtrl(self,
                                   -1,
                                   "",
                                   style=wx.TE_MULTILINE | wx.TE_READONLY
                                   | wx.TE_RICH)
     self.replace_text = wx.TextCtrl(self,
                                     -1,
                                     "",
                                     style=wx.TE_PROCESS_ENTER)
     self.replace_list = wx.ListBox(self, -1, style=wx.LB_SINGLE)
     self.InitLayout()
     wx.EVT_LISTBOX(self, self.replace_list.GetId(), self.OnReplSelect)
     wx.EVT_LISTBOX_DCLICK(self, self.replace_list.GetId(), self.OnReplace)
Пример #7
0
    def POL_SetupWindow_prefix_selector(self, message, title):
        self.Destroy_all()
        self.DrawDefault(message, title)

        self.add_games()
        self.MenuGames.Show()

        self.space = message.count("\\n") + 1
        self.Menu.SetPosition((20, 85 + self.space * 16))
        self.Menu.Clear()

        self.areaList = os.listdir(Variables.playonlinux_rep + "/wineprefix/")
        self.areaList.sort()

        for file in self.areaList:
            if (str(file[0]) == "."):
                self.areaList.remove(file)

        self.Menu.InsertItems(self.areaList, 0)
        self.Menu.Select(0)
        self.Menu.Hide()

        self.DrawCancel()
        self.DrawNext()

        wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menuprefixes)
        wx.EVT_TREE_ITEM_ACTIVATED(self, 111, self.release_menuprefixes)
        wx.EVT_LISTBOX_DCLICK(self, 104, self.release_menuprefixes)

        self.PCheckBox.Show()
Пример #8
0
    def __init__(self, parent, pWiki):
        wx.HtmlListBox.__init__(self, parent, -1)

        self.pWiki = pWiki

        self.parent = parent

        wx.EVT_LISTBOX_DCLICK(self, -1, self.OnDClick)
Пример #9
0
 def __init__(self, parent):
     wx.ListBox.__init__(self,
                         parent,
                         -1,
                         style=wx.LB_SINGLE | wx.LB_NEEDED_SB)
     self.parent = parent.GetParent()
     wx.EVT_LISTBOX_DCLICK(parent, self.GetId(), self.OnItemActivated)
     self.last = ''
     self.pattern = None
Пример #10
0
	def __register_interests(self):
		"""Configure enabled event signals
		"""
		# wxPython events
		wx.EVT_LISTBOX_DCLICK(self.__LST_problems, self.__LST_problems.GetId(), self.__on_problem_activated)
		wx.EVT_BUTTON(self.__BTN_save, self.__BTN_save.GetId(), self.__on_save)
		wx.EVT_BUTTON(self.__BTN_clear, self.__BTN_clear.GetId(), self.__on_clear)
		wx.EVT_BUTTON(self.__BTN_discard, self.__BTN_discard.GetId(), self.__on_discard)
		wx.EVT_BUTTON(self.__BTN_add_unassociated, self.__BTN_add_unassociated.GetId(), self.__on_add_unassociated)

		# client internal signals
		gmDispatcher.connect(signal='post_patient_selection', receiver=self._on_post_patient_selection)
		gmDispatcher.connect(signal = 'clin.episode_mod_db', receiver = self._on_episode_issue_mod_db)
		gmDispatcher.connect(signal = 'clin.health_issue_mod_db', receiver = self._on_episode_issue_mod_db)
Пример #11
0
    def POL_SetupWindow_menu(self, message, title, liste, cut, numtype=False):
        self.Destroy_all()
        self.DrawDefault(message, title)

        self.space = message.count("\\n") + 1
        self.areaList = string.split(liste, cut)

        self.Menu.SetPosition((20, 85 + self.space * 16))

        self.Menu.Clear()
        self.Menu.InsertItems(self.areaList, 0)
        self.Menu.Select(0)
        self.Menu.Show()

        self.DrawCancel()
        self.DrawNext()

        if (numtype == False):
            wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menu)
            wx.EVT_LISTBOX_DCLICK(self, 104, self.release_menu)
        else:
            wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menu_num)
            wx.EVT_LISTBOX_DCLICK(self, 104, self.release_menu_num)
Пример #12
0
    def SetupControls(self, vbsouter):
        vbsouter.Clear(True)
        hbs = wx.BoxSizer(wx.HORIZONTAL)
        self.cropselect = ImageCropSelect(self, self.image)

        self.vbs = wx.BoxSizer(wx.VERTICAL)
        self.colourselect = wx.lib.colourselect.ColourSelect(
            self, wx.NewId(), "Background Color ...", (255, 255, 255))
        self.vbs.Add(self.colourselect, 0, wx.ALL | wx.EXPAND, 5)
        wx.lib.colourselect.EVT_COLOURSELECT(self, self.colourselect.GetId(),
                                             self.OnBackgroundColour)
        self.vbs.Add(wx.StaticText(self, -1, "Target"), 0, wx.ALL, 5)
        self.targetbox = wx.ListBox(self, -1, size=(-1, 100))
        self.vbs.Add(self.targetbox, 0, wx.EXPAND | wx.ALL, 5)
        self.vbs.Add(wx.StaticText(self, -1, "Scale"), 0, wx.ALL, 5)

        for one, (s, _) in enumerate(self.SCALES):
            if s == 1: break
        self.slider = wx.Slider(self,
                                -1,
                                one,
                                0,
                                len(self.SCALES) - 1,
                                style=wx.HORIZONTAL | wx.SL_AUTOTICKS)
        self.vbs.Add(self.slider, 0, wx.ALL | wx.EXPAND, 5)
        self.zoomlabel = wx.StaticText(self, -1, self.SCALES[one][1])
        self.vbs.Add(self.zoomlabel, 0, wx.ALL | wx.ALIGN_CENTRE_HORIZONTAL, 5)

        self.vbs.Add(wx.StaticText(self, -1, "Preview"), 0, wx.ALL, 5)
        self.imagepreview = ImagePreview(self)
        self.cropselect.SetPreviewWindow(self.imagepreview)
        self.vbs.Add(self.imagepreview, 0, wx.ALL, 5)

        hbs.Add(self.vbs, 0, wx.ALL, 5)
        hbs.Add(self.cropselect, 1, wx.ALL | wx.EXPAND, 5)

        vbsouter.Add(hbs, 1, wx.EXPAND | wx.ALL, 5)

        vbsouter.Add(wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL), 0,
                     wx.EXPAND | wx.ALL, 5)
        vbsouter.Add(self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.HELP), 0,
                     wx.ALIGN_CENTRE | wx.ALL, 5)

        wx.EVT_SCROLL(self, self.SetZoom)
        wx.EVT_LISTBOX(self, self.targetbox.GetId(), self.OnTargetSelect)
        wx.EVT_LISTBOX_DCLICK(self, self.targetbox.GetId(),
                              self.OnTargetSelect)

        self.OnOriginSelect()
Пример #13
0
    def _create_control(self, parent):
        """ Creates the widget. """

        self.control = wx.ListBox(parent, -1, style=self.STYLE)

        # Wire it up!
        wx.EVT_LISTBOX(self.control, self.control.GetId(),
                       self._on_item_selected)
        wx.EVT_LISTBOX_DCLICK(self.control, self.control.GetId(),
                              self._on_item_activated)

        # Populate the list.
        self._populate()

        return
Пример #14
0
    def __init__(self, titre):
        wx.Frame.__init__(self,
                          None,
                          -1,
                          title=titre,
                          style=wx.CLOSE_BOX | wx.MINIMIZE_BOX,
                          size=(520, 290))
        self.SetIcon(
            wx.Icon(Variables.playonlinux_env + "/etc/playonlinux.png",
                    wx.BITMAP_TYPE_ANY))
        self.panelFenp = wx.Panel(self, -1)
        self.fontTexte = wx.Font(12, wx.FONTFAMILY_DEFAULT,
                                 wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD,
                                 False, "", wx.FONTENCODING_DEFAULT)

        self.txtTitre = wx.StaticText(self.panelFenp, -1, Variables.titre,
                                      (20, 25), wx.DefaultSize)
        self.txtTitre.SetFont(self.fontTexte)
        self.txtTexte = wx.StaticText(self.panelFenp, -1, Variables.texte,
                                      (155, 65), wx.DefaultSize)
        self.txtTexte.Wrap(330)
        if Variables.nombreEtape != "0":
            self.txtEtape = wx.StaticText(self.panelFenp, -1,
                                          Variables.etape_txt, (20, 265),
                                          wx.DefaultSize)

        self.buttonSuivant = wx.Button(self.panelFenp, ID_NEXT, Variables.next,
                                       (425, 250), wx.DefaultSize)

        if Variables.cancel_present == "1":
            self.buttonAnnuler = wx.Button(self.panelFenp, ID_CANCEL,
                                           _("Cancel"), (330, 250),
                                           wx.DefaultSize)
        self.Menu = wx.ListBox(self.panelFenp,
                               103,
                               pos=wx.Point(145, 100),
                               size=(345, 130),
                               choices=Variables.areaList)
        self.Menu.Select(0)
        self.imageLogo = wx.Bitmap(Variables.image_use)
        self.canvasLogo = wx.StaticBitmap(self.panelFenp, -1, self.imageLogo,
                                          (30, 65), wx.DefaultSize)

        wx.EVT_BUTTON(self, ID_CANCEL, self.Cancel)
        wx.EVT_BUTTON(self, ID_NEXT, self.Next)
        wx.EVT_LISTBOX_DCLICK(self, 103, self.Next)
Пример #15
0
    def __init__(self, parent, wxId, id, style=0):
        """Construct a FormattedList object.

        @param parent Parent wxWidget.
        @param wxId wxWidgets ID of the new widget (integer).
        @param id Identifier of the new widget (string).
        """
        # This item array is also used by the HtmlListBox instance.
        # This is a list of tuples: (id, presentation)
        self.items = []

        base.Widget.__init__(self, HtmlListBox(parent, wxId, self,
                                               style=style))

        self.widgetId = id

        # By default, items are added in alphabetical order.
        self.addSorted = True

        # Listen for selection changes.
        wx.EVT_RIGHT_DOWN(self.getWxWidget(), self.onRightDown)
        wx.EVT_LISTBOX(parent, wxId, self.onItemSelected)
        wx.EVT_LISTBOX_DCLICK(parent, wxId, self.onItemDoubleClick)
Пример #16
0
    def createLayout(self):
        self.listbox = wx.ListBox(self, ID_LISTBOX, wx.DefaultPosition,
                                  wx.DefaultSize, [],
                                  wx.LB_SINGLE | wx.LB_SORT,
                                  wx.DefaultValidator)
        self.listbox.typedText = ""

        s = ""
        try:
            if (os.name == "posix"):
                #s = "/dev/cu.PL2303-3B1\t"
                s = "/dev/ttyUSB0\t"
            if (os.name == "nt"):
                for i in range(1, 10):
                    s += "COM" + str(i) + "\t"
        except:
            print_exc()
        for i in s.split("\t"):
            if i:
                self.listbox.Append(i)

        self.bOK = wx.Button(self, ID_BUTTON_OK, "OK")
        self.bCancel = wx.Button(self, ID_BUTTON_CANCEL, "Cancel")

        self.sizer1 = wx.BoxSizer(wx.VERTICAL)
        self.sizer2 = wx.BoxSizer(wx.HORIZONTAL)
        self.sizer2.Add(self.bOK, 1, wx.EXPAND | wx.ALL, 10)
        self.sizer2.Add(self.bCancel, 1, wx.EXPAND | wx.ALL, 10)
        self.sizer1.Add(self.listbox, 1, wx.EXPAND | wx.ALL, 20)
        self.sizer1.Add(self.sizer2)
        self.SetSizer(self.sizer1)
        self.SetAutoLayout(1)
        self.sizer1.Fit(self)

        wx.EVT_LISTBOX_DCLICK(self, ID_LISTBOX, self.selectNewReaderOK)
        wx.EVT_BUTTON(self, ID_BUTTON_OK, self.selectNewReaderOK)
        wx.EVT_BUTTON(self, ID_BUTTON_CANCEL, self.selectNewReaderCancel)
Пример #17
0
    def Packages(self, nom):
        self.panelPackages = wx.Panel(self, -1)
        self.txtPackages = wx.StaticText(self.panelPackages, -1, _(nom),
                                         (10, 10), wx.DefaultSize)
        self.txtPackages.SetFont(self.fontTitle)

        self.Menu = wx.ListBox(self.panelPackages,
                               99,
                               pos=(15, 45),
                               size=(430, 235),
                               style=Variables.widget_borders)
        self.PackageButton = wx.Button(self.panelPackages,
                                       98,
                                       _("Install"),
                                       pos=(10, 295))

        try:
            self.available_packages = open(
                Variables.playonlinux_rep +
                "/configurations/listes/POL_Functions", "r").read()
            self.available_packages = string.split(self.available_packages,
                                                   "/")
            self.available_packages_ = []
            for key in self.available_packages:
                if ("POL_Install" in key):
                    self.available_packages_.append(
                        key.replace("POL_Install_", ""))
            self.available_packages.sort()
            self.Menu.InsertItems(self.available_packages_, 0)
            self.Menu.Select(0)
        except:  # File does not exits ; it will be created when pol is updated
            pass
        #$REPERTOIRE/configurations/listes/
        wx.EVT_LISTBOX_DCLICK(self, 99, self.install_package)
        wx.EVT_BUTTON(self, 98, self.install_package)

        self.AddPage(self.panelPackages, nom)
Пример #18
0
    def __init__(self, parent, id, title, ep_object):
        # Make the Keyword Edit List resizable by passing wx.RESIZE_BORDER style
        Dialogs.GenForm.__init__(self, parent, id, title, (550,435), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
                                 useSizers = True, HelpContext='Episode Properties')
        # Remember the Parent Window
        self.parent = parent
        self.obj = ep_object

        # Create the form's main VERTICAL sizer
        mainSizer = wx.BoxSizer(wx.VERTICAL)

        # Create a HORIZONTAL sizer for the first row
        r1Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v1 = wx.BoxSizer(wx.VERTICAL)
        # Episode ID
        self.id_edit = self.new_edit_box(_("Episode ID"), v1, self.obj.id, maxLen=100)
        # Add the element to the sizer
        r1Sizer.Add(v1, 1, wx.EXPAND)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r1Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))

        # Create a HORIZONTAL sizer for the next row
        r2Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v2 = wx.BoxSizer(wx.VERTICAL)
        # Library ID layout
        series_edit = self.new_edit_box(_("Library ID"), v2, self.obj.series_id)
        # Add the element to the sizer
        r2Sizer.Add(v2, 2, wx.EXPAND)
        series_edit.Enable(False)

        # Add a horizontal spacer to the row sizer        
        r2Sizer.Add((10, 0))

        # Dialogs.GenForm does not provide a Masked text control, so the Date
        # Field is handled differently than other fields.
        
        # Create a VERTICAL sizer for the next element
        v3 = wx.BoxSizer(wx.VERTICAL)
        # Date [label]
        date_lbl = wx.StaticText(self.panel, -1, _("Date (MM/DD/YYYY)"))
        v3.Add(date_lbl, 0, wx.BOTTOM, 3)

        # Date
        # Use the Masked Text Control (Requires wxPython 2.4.2.4 or later)
        # TODO:  Make Date autoformat localizable
        self.dt_edit = wx.lib.masked.TextCtrl(self.panel, -1, '', autoformat='USDATEMMDDYYYY/')
        v3.Add(self.dt_edit, 0, wx.EXPAND)
        # If a Date is know, load it into the control
        if (self.obj.tape_date != None) and (self.obj.tape_date != '') and (self.obj.tape_date != '01/01/0'):
            self.dt_edit.SetValue(self.obj.tape_date)
        # Add the element to the sizer
        r2Sizer.Add(v3, 1, wx.EXPAND)

        # Add a horizontal spacer to the row sizer        
        r2Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v4 = wx.BoxSizer(wx.VERTICAL)
        # Length
        self.len_edit = self.new_edit_box(_("Length"), v4, self.obj.tape_length_str())
        # Add the element to the sizer
        r2Sizer.Add(v4, 1, wx.EXPAND)
        self.len_edit.Enable(False)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r2Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))

        # Media Filename(s) [label]
        txt = wx.StaticText(self.panel, -1, _("Media Filename(s)"))
        mainSizer.Add(txt, 0, wx.BOTTOM, 3)

        # Create a HORIZONTAL sizer for the next row
        r3Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Media Filename(s)
        # If the media filename path is not empty, we should normalize the path specification
        if self.obj.media_filename == '':
            filePath = self.obj.media_filename
        else:
            filePath = os.path.normpath(self.obj.media_filename)
        # Initialize the list of media filenames with the first one.
        self.filenames = [filePath]
        # For each additional Media file ...
        for vid in self.obj.additional_media_files:
            # ... add it to the filename list
            self.filenames.append(vid['filename'])
        self.fname_lb = wx.ListBox(self.panel, -1, wx.DefaultPosition, wx.Size(180, 60), self.filenames)
        # Add the element to the sizer
        r3Sizer.Add(self.fname_lb, 5, wx.EXPAND)
        self.fname_lb.SetDropTarget(ListBoxFileDropTarget(self.fname_lb))
        
        # Add a horizontal spacer to the row sizer        
        r3Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v4 = wx.BoxSizer(wx.VERTICAL)
        # Add File button layout
        addFile = wx.Button(self.panel, wx.ID_FILE1, _("Add File"), wx.DefaultPosition)
        v4.Add(addFile, 0, wx.EXPAND | wx.BOTTOM, 3)
        wx.EVT_BUTTON(self, wx.ID_FILE1, self.OnBrowse)

        # Remove File button layout
        removeFile = wx.Button(self.panel, -1, _("Remove File"), wx.DefaultPosition)
        v4.Add(removeFile, 0, wx.EXPAND | wx.BOTTOM, 3)
        wx.EVT_BUTTON(self, removeFile.GetId(), self.OnRemoveFile)

        if TransanaConstants.proVersion:
            # SynchronizeFiles button layout
            synchronize = wx.Button(self.panel, -1, _("Synchronize"), wx.DefaultPosition)
            v4.Add(synchronize, 0, wx.EXPAND)
            synchronize.Bind(wx.EVT_BUTTON, self.OnSynchronize)

        # Add the element to the sizer
        r3Sizer.Add(v4, 1, wx.EXPAND)
        # If Mac ...
        if 'wxMac' in wx.PlatformInfo:
            # ... add a spacer to avoid control clipping
            r3Sizer.Add((2, 0))

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r3Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))

        # Create a HORIZONTAL sizer for the next row
        r4Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v5 = wx.BoxSizer(wx.VERTICAL)
        # Comment
        comment_edit = self.new_edit_box(_("Comment"), v5, self.obj.comment, maxLen=255)
        # Add the element to the sizer
        r4Sizer.Add(v5, 1, wx.EXPAND)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r4Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))
        
        # Create a HORIZONTAL sizer for the next row
        r5Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v6 = wx.BoxSizer(wx.VERTICAL)
        # Keyword Group [label]
        txt = wx.StaticText(self.panel, -1, _("Keyword Group"))
        v6.Add(txt, 0, wx.BOTTOM, 3)

        # Keyword Group [list box]

        kw_groups_id = wx.NewId()
        # Create an empty Keyword Group List for now.  We'll populate it later (for layout reasons)
        self.kw_groups = []
        self.kw_group_lb = wx.ListBox(self.panel, kw_groups_id, wx.DefaultPosition, wx.DefaultSize, self.kw_groups)
        v6.Add(self.kw_group_lb, 1, wx.EXPAND)

        # Add the element to the sizer
        r5Sizer.Add(v6, 1, wx.EXPAND)

        self.kw_list = []
        wx.EVT_LISTBOX(self, kw_groups_id, self.OnGroupSelect)

        # Add a horizontal spacer
        r5Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v7 = wx.BoxSizer(wx.VERTICAL)
        # Keyword [label]
        txt = wx.StaticText(self.panel, -1, _("Keyword"))
        v7.Add(txt, 0, wx.BOTTOM, 3)

        # Keyword [list box]
        self.kw_lb = wx.ListBox(self.panel, -1, wx.DefaultPosition, wx.DefaultSize, self.kw_list, style=wx.LB_EXTENDED)
        v7.Add(self.kw_lb, 1, wx.EXPAND)

        wx.EVT_LISTBOX_DCLICK(self, self.kw_lb.GetId(), self.OnAddKW)

        # Add the element to the sizer
        r5Sizer.Add(v7, 1, wx.EXPAND)

        # Add a horizontal spacer
        r5Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v8 = wx.BoxSizer(wx.VERTICAL)
        # Keyword transfer buttons
        add_kw = wx.Button(self.panel, wx.ID_FILE2, ">>", wx.DefaultPosition)
        v8.Add(add_kw, 0, wx.EXPAND | wx.TOP, 20)
        wx.EVT_BUTTON(self.panel, wx.ID_FILE2, self.OnAddKW)

        rm_kw = wx.Button(self.panel, wx.ID_FILE3, "<<", wx.DefaultPosition)
        v8.Add(rm_kw, 0, wx.EXPAND | wx.TOP, 10)
        wx.EVT_BUTTON(self, wx.ID_FILE3, self.OnRemoveKW)

        kwm = wx.BitmapButton(self.panel, wx.ID_FILE4, TransanaImages.KWManage.GetBitmap())
        v8.Add(kwm, 0, wx.EXPAND | wx.TOP, 10)
        # Add a spacer to increase the height of the Keywords section
        v8.Add((0, 60))
        kwm.SetToolTipString(_("Keyword Management"))
        wx.EVT_BUTTON(self, wx.ID_FILE4, self.OnKWManage)

        # Add the element to the sizer
        r5Sizer.Add(v8, 0)

        # Add a horizontal spacer
        r5Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v9 = wx.BoxSizer(wx.VERTICAL)

        # Episode Keywords [label]
        txt = wx.StaticText(self.panel, -1, _("Episode Keywords"))
        v9.Add(txt, 0, wx.BOTTOM, 3)

        # Episode Keywords [list box]
        
        # Create an empty ListBox
        self.ekw_lb = wx.ListBox(self.panel, -1, wx.DefaultPosition, wx.DefaultSize, style=wx.LB_EXTENDED)
        v9.Add(self.ekw_lb, 1, wx.EXPAND)
        
        self.ekw_lb.Bind(wx.EVT_KEY_DOWN, self.OnKeywordKeyDown)

        # Add the element to the sizer
        r5Sizer.Add(v9, 2, wx.EXPAND)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r5Sizer, 5, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))
        
        # Create a sizer for the buttons
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)

        # Core Data button layout
        CoreData = wx.Button(self.panel, -1, _("Core Data"))
        # If Mac ...
        if 'wxMac' in wx.PlatformInfo:
            # ... add a spacer to avoid control clipping
            btnSizer.Add((2, 0))
        btnSizer.Add(CoreData, 0)
        wx.EVT_BUTTON(self, CoreData.GetId(), self.OnCoreDataClick)

        # Add the buttons
        self.create_buttons(sizer=btnSizer)
        # Add the button sizer to the main sizer
        mainSizer.Add(btnSizer, 0, wx.EXPAND)
        # If Mac ...
        if 'wxMac' in wx.PlatformInfo:
            # ... add a spacer to avoid control clipping
            mainSizer.Add((0, 2))

        # Set the PANEL's main sizer
        self.panel.SetSizer(mainSizer)
        # Tell the PANEL to auto-layout
        self.panel.SetAutoLayout(True)
        # Lay out the Panel
        self.panel.Layout()
        # Lay out the panel on the form
        self.Layout()
        # Resize the form to fit the contents
        self.Fit()

        # Get the new size of the form
        (width, height) = self.GetSizeTuple()
        # Reset the form's size to be at least the specified minimum width
        self.SetSize(wx.Size(max(550, width), max(435, height)))
        # Define the minimum size for this dialog as the current size
        self.SetSizeHints(max(550, width), max(435, height))
        # Center the form on screen
        TransanaGlobal.CenterOnPrimary(self)

        # We need to set some minimum sizes so the sizers will work right
        self.kw_group_lb.SetSizeHints(minW = 50, minH = 20)
        self.kw_lb.SetSizeHints(minW = 50, minH = 20)
        self.ekw_lb.SetSizeHints(minW = 50, minH = 20)

        # We populate the Keyword Groups, Keywords, and Clip Keywords lists AFTER we determine the Form Size.
        # Long Keywords in the list were making the form too big!

        self.kw_groups = DBInterface.list_of_keyword_groups()
        for keywordGroup in self.kw_groups:
            self.kw_group_lb.Append(keywordGroup)

        # Load the parent Library in order to determine the default Keyword Group
        tempLibrary = Library.Library(self.obj.series_id)
        # Select the Library Default Keyword Group in the Keyword Group list
        if (tempLibrary.keyword_group != '') and (self.kw_group_lb.FindString(tempLibrary.keyword_group) != wx.NOT_FOUND):
            self.kw_group_lb.SetStringSelection(tempLibrary.keyword_group)
        # If no Default Keyword Group is defined, select the first item in the list
        else:
            # but only if there IS a first item in the list.
            if len(self.kw_groups) > 0:
                self.kw_group_lb.SetSelection(0)
        if self.kw_group_lb.GetSelection() != wx.NOT_FOUND:
            self.kw_list = \
                DBInterface.list_of_keywords_by_group(self.kw_group_lb.GetStringSelection())
        else:
            self.kw_list = []
        for keyword in self.kw_list:
            self.kw_lb.Append(keyword)

        # Populate the ListBox
        for episodeKeyword in self.obj.keyword_list:
            self.ekw_lb.Append(episodeKeyword.keywordPair)

        self.id_edit.SetFocus()
Пример #19
0
    def __init__(self, parent, id, title, quote_object, mergeList=None):
        # If no Merge List is passed in ...
        if mergeList == None:
            # ... use the default Quote Properties Dialog size passed in from the config object.  (This does NOT get saved.)
            size = TransanaGlobal.configData.quotePropertiesSize
            # ... we can enable Quote Change Propagation
            propagateEnabled = True
            HelpContext = 'Quote Properties'
        # If we DO have a merge list ...
        else:
            # ... increase the size of the dialog to allow for the list of mergeable quotes.
            size = (TransanaGlobal.configData.quotePropertiesSize[0],
                    TransanaGlobal.configData.quotePropertiesSize[1] + 130)
            # ... and Quote Change Propagation should be disabled
            propagateEnabled = False
            HelpContext = 'Quote Merge'

        # Make the Keyword Edit List resizable by passing wx.RESIZE_BORDER style.  Signal that Propogation is included.
        Dialogs.GenForm.__init__(self,
                                 parent,
                                 id,
                                 title,
                                 size=size,
                                 style=wx.DEFAULT_DIALOG_STYLE
                                 | wx.RESIZE_BORDER,
                                 propagateEnabled=propagateEnabled,
                                 useSizers=True,
                                 HelpContext=HelpContext)
        if mergeList == None:
            # Define the minimum size for this dialog as the initial size
            minWidth = 750
            minHeight = 570
        else:
            # Define the minimum size for this dialog as the initial size
            minWidth = 750
            minHeight = 650
        # Remember the Parent Window
        self.parent = parent
        # Remember the original Quote Object passed in
        self.obj = quote_object
        # Add a placeholder to the quote object for the merge quote number
        self.obj.mergeNumber = 0
        # Remember the merge list, if one is passed in
        self.mergeList = mergeList
        # Initialize the merge item as unselected
        self.mergeItemIndex = -1
        # if Keywords that server as Keyword Examples are removed, we will need to remember them.
        # Then, when OK is pressed, the Keyword Example references in the Database Tree can be removed.
        # We can't remove them immediately in case the whole Quote Properties Edit process is cancelled.
        self.keywordExamplesToDelete = []
        # Initialize a variable to hold merged keyword examples.
        self.mergedKeywordExamples = []

        # Create the form's main VERTICAL sizer
        mainSizer = wx.BoxSizer(wx.VERTICAL)

        # If we're merging Quotes ...
        if self.mergeList != None:

            # ... display a label for the Merge Quotes ...
            lblMergeQuote = wx.StaticText(self.panel, -1, _("Quote to Merge"))
            mainSizer.Add(lblMergeQuote, 0)

            # Add a vertical spacer to the main sizer
            mainSizer.Add((0, 3))

            # Create a HORIZONTAL sizer for the merge information
            mergeSizer = wx.BoxSizer(wx.HORIZONTAL)

            # ... display a ListCtrl for the Merge Quotes ...
            self.mergeQuotes = wx.ListCtrl(self.panel,
                                           -1,
                                           size=(300, 100),
                                           style=wx.LC_REPORT
                                           | wx.LC_SINGLE_SEL)
            # Add the element to the sizer
            mergeSizer.Add(self.mergeQuotes, 1, wx.EXPAND)
            # ... bind the Item Selected event for the List Control ...
            self.mergeQuotes.Bind(wx.EVT_LIST_ITEM_SELECTED,
                                  self.OnItemSelected)

            # ... define the columns for the Merge Quotes ...
            self.mergeQuotes.InsertColumn(0, _('Quote Name'))
            self.mergeQuotes.InsertColumn(1, _('Collection'))
            self.mergeQuotes.InsertColumn(2, _('Start Character'))
            self.mergeQuotes.InsertColumn(3, _('End Character'))
            self.mergeQuotes.SetColumnWidth(0, 244)
            self.mergeQuotes.SetColumnWidth(1, 244)
            # ... and populate the Merge Quotes list from the mergeList data
            for (QuoteNum, QuoteID, DocumentNum, CollectNum, CollectID,
                 StartChar, EndChar) in self.mergeList:
                index = self.mergeQuotes.InsertStringItem(sys.maxint, QuoteID)
                self.mergeQuotes.SetStringItem(index, 1, CollectID)
                self.mergeQuotes.SetStringItem(index, 2, u"%s" % StartChar)
                self.mergeQuotes.SetStringItem(index, 3, u"%s" % EndChar)

            # Add the row sizer to the main vertical sizer
            mainSizer.Add(mergeSizer, 3, wx.EXPAND)

            # Add a vertical spacer to the main sizer
            mainSizer.Add((0, 10))

        # Create a HORIZONTAL sizer for the first row
        r1Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v1 = wx.BoxSizer(wx.VERTICAL)
        # Quote ID
        self.id_edit = self.new_edit_box(_("Quote ID"),
                                         v1,
                                         self.obj.id,
                                         maxLen=100)
        # Add the element to the sizer
        r1Sizer.Add(v1, 1, wx.EXPAND)

        # Add a horizontal spacer to the row sizer
        r1Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v2 = wx.BoxSizer(wx.VERTICAL)
        # Collection ID
        collection_edit = self.new_edit_box(_("Collection ID"), v2,
                                            self.obj.GetNodeString(False))
        # Add the element to the sizer
        r1Sizer.Add(v2, 2, wx.EXPAND)
        collection_edit.Enable(False)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r1Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer
        mainSizer.Add((0, 10))

        # Create a HORIZONTAL sizer for the next row
        r2Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # If the source document is known ...
        if self.obj.source_document_num > 0:
            try:
                tmpSrcDoc = Document.Document(num=self.obj.source_document_num)
                srcDocID = tmpSrcDoc.id
                tmpLibrary = Library.Library(tmpSrcDoc.library_num)
                libraryID = tmpLibrary.id
            except TransanaExceptions.RecordNotFoundError:
                srcDocID = ''
                libraryID = ''
                self.obj.source_document_id = 0
            except:
                print
                print sys.exc_info()[0]
                print sys.exc_info()[1]
                self.obj.source_document_id = 0
                srcDocID = ''
                libraryID = ''
        else:
            srcDocID = ''
            libraryID = ''
        # Create a VERTICAL sizer for the next element
        v3 = wx.BoxSizer(wx.VERTICAL)
        # Library ID
        library_edit = self.new_edit_box(_("Library ID"), v3, libraryID)
        # Add the element to the sizer
        r2Sizer.Add(v3, 1, wx.EXPAND)
        library_edit.Enable(False)

        # Add a horizontal spacer to the row sizer
        r2Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v4 = wx.BoxSizer(wx.VERTICAL)
        # Document ID
        document_edit = self.new_edit_box(_("Document ID"), v4, srcDocID)
        # Add the element to the sizer
        r2Sizer.Add(v4, 1, wx.EXPAND)
        document_edit.Enable(False)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r2Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer
        mainSizer.Add((0, 10))

        # Create a HORIZONTAL sizer for the next row
        r4Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v5 = wx.BoxSizer(wx.VERTICAL)
        # Quote Start Character
        self.quote_start_edit = self.new_edit_box(_("Quote Start Character"),
                                                  v5,
                                                  unicode(self.obj.start_char))
        # Add the element to the sizer
        r4Sizer.Add(v5, 1, wx.EXPAND)
        # For merging, we need to remember the merged value of Quote Start Char
        self.start_char = self.obj.start_char
        self.quote_start_edit.Enable(False)

        # Add a horizontal spacer to the row sizer
        r4Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v6 = wx.BoxSizer(wx.VERTICAL)
        # Quote End Character
        self.quote_end_edit = self.new_edit_box(_("Quote End Character"), v6,
                                                unicode(self.obj.end_char))
        # Add the element to the sizer
        r4Sizer.Add(v6, 1, wx.EXPAND)
        # For merging, we need to remember the merged value of Quote End Char
        self.end_char = self.obj.end_char
        self.quote_end_edit.Enable(False)

        # Add a horizontal spacer to the row sizer
        r4Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v7 = wx.BoxSizer(wx.VERTICAL)
        # Quote Length
        self.quote_length_edit = self.new_edit_box(
            _("Quote Length"), v7,
            unicode(self.obj.end_char - self.obj.start_char))
        # Add the element to the sizer
        r4Sizer.Add(v7, 1, wx.EXPAND)
        self.quote_length_edit.Enable(False)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r4Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer
        mainSizer.Add((0, 10))

        # Create a HORIZONTAL sizer for the next row
        r5Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v8 = wx.BoxSizer(wx.VERTICAL)
        # Comment
        comment_edit = self.new_edit_box(_("Comment"),
                                         v8,
                                         self.obj.comment,
                                         maxLen=255)
        # Add the element to the sizer
        r5Sizer.Add(v8, 1, wx.EXPAND)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r5Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer
        mainSizer.Add((0, 10))

        txt = wx.StaticText(self.panel, -1, _("Quote Text"))
        mainSizer.Add(txt, 0, wx.BOTTOM, 3)
        self.text_edit = TranscriptEditor_RTC.TranscriptEditor(self.panel)
        self.text_edit.load_transcript(self.obj)
        self.text_edit.SetReadOnly(False)
        self.text_edit.Enable(True)
        mainSizer.Add(self.text_edit, 6, wx.EXPAND)

        # Add a vertical spacer to the main sizer
        mainSizer.Add((0, 10))

        # Create a HORIZONTAL sizer for the next row
        r7Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v9 = wx.BoxSizer(wx.VERTICAL)
        # Keyword Group [label]
        txt = wx.StaticText(self.panel, -1, _("Keyword Group"))
        v9.Add(txt, 0, wx.BOTTOM, 3)

        # Keyword Group [list box]

        # Create an empty Keyword Group List for now.  We'll populate it later (for layout reasons)
        self.kw_groups = []
        self.kw_group_lb = wx.ListBox(self.panel, -1, choices=self.kw_groups)
        v9.Add(self.kw_group_lb, 1, wx.EXPAND)

        # Add the element to the sizer
        r7Sizer.Add(v9, 1, wx.EXPAND)

        # Create an empty Keyword List for now.  We'll populate it later (for layout reasons)
        self.kw_list = []
        wx.EVT_LISTBOX(self, self.kw_group_lb.GetId(), self.OnGroupSelect)

        # Add a horizontal spacer
        r7Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v10 = wx.BoxSizer(wx.VERTICAL)
        # Keyword [label]
        txt = wx.StaticText(self.panel, -1, _("Keyword"))
        v10.Add(txt, 0, wx.BOTTOM, 3)

        # Keyword [list box]
        self.kw_lb = wx.ListBox(self.panel,
                                -1,
                                choices=self.kw_list,
                                style=wx.LB_EXTENDED)
        v10.Add(self.kw_lb, 1, wx.EXPAND)

        wx.EVT_LISTBOX_DCLICK(self, self.kw_lb.GetId(), self.OnAddKW)

        # Add the element to the sizer
        r7Sizer.Add(v10, 1, wx.EXPAND)

        # Add a horizontal spacer
        r7Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v11 = wx.BoxSizer(wx.VERTICAL)
        # Keyword transfer buttons
        add_kw = wx.Button(self.panel, wx.ID_FILE2, ">>", wx.DefaultPosition)
        v11.Add(add_kw, 0, wx.EXPAND | wx.TOP, 20)
        wx.EVT_BUTTON(self, wx.ID_FILE2, self.OnAddKW)

        rm_kw = wx.Button(self.panel, wx.ID_FILE3, "<<", wx.DefaultPosition)
        v11.Add(rm_kw, 0, wx.EXPAND | wx.TOP, 10)
        wx.EVT_BUTTON(self, wx.ID_FILE3, self.OnRemoveKW)

        kwm = wx.BitmapButton(self.panel, wx.ID_FILE4,
                              TransanaImages.KWManage.GetBitmap())
        v11.Add(kwm, 0, wx.EXPAND | wx.TOP, 10)
        kwm.SetToolTipString(_("Keyword Management"))
        wx.EVT_BUTTON(self, wx.ID_FILE4, self.OnKWManage)

        # Add the element to the sizer
        r7Sizer.Add(v11, 0)

        # Add a horizontal spacer
        r7Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v12 = wx.BoxSizer(wx.VERTICAL)

        # Quote Keywords [label]
        txt = wx.StaticText(self.panel, -1, _("Quote Keywords"))
        v12.Add(txt, 0, wx.BOTTOM, 3)

        # Quote Keywords [list box]
        # Create an empty ListBox.  We'll populate it later for layout reasons.
        self.ekw_lb = wx.ListBox(self.panel, -1, style=wx.LB_EXTENDED)
        v12.Add(self.ekw_lb, 1, wx.EXPAND)

        self.ekw_lb.Bind(wx.EVT_KEY_DOWN, self.OnKeywordKeyDown)

        # Add the element to the sizer
        r7Sizer.Add(v12, 2, wx.EXPAND)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r7Sizer, 8, wx.EXPAND)

        # Add a vertical spacer to the main sizer
        mainSizer.Add((0, 10))

        # Create a sizer for the buttons
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        # Add the buttons
        self.create_buttons(sizer=btnSizer)
        # Add the button sizer to the main sizer
        mainSizer.Add(btnSizer, 0, wx.EXPAND)

        # Because of the way Quotes are created (with Drag&Drop / Cut&Paste functions), we have to trap the missing
        # ID error here.  Therefore, we need to override the EVT_BUTTON for the OK Button.
        # Since we don't have an object for the OK Button, we use FindWindowById to find it based on its ID.
        self.Bind(wx.EVT_BUTTON, self.OnOK, self.FindWindowById(wx.ID_OK))
        # We also need to intercept the Cancel button.
        self.Bind(wx.EVT_BUTTON, self.OnCancel,
                  self.FindWindowById(wx.ID_CANCEL))

        # Set the PANEL's main sizer
        self.panel.SetSizer(mainSizer)
        # Tell the PANEL to auto-layout
        self.panel.SetAutoLayout(True)
        # Lay out the Panel
        self.panel.Layout()
        # Lay out the panel on the form
        self.Layout()
        # Resize the form to fit the contents
        self.Fit()

        # Get the new size of the form
        (width, height) = self.GetSizeTuple()
        # Determine which monitor to use and get its size and position
        if TransanaGlobal.configData.primaryScreen < wx.Display.GetCount():
            primaryScreen = TransanaGlobal.configData.primaryScreen
        else:
            primaryScreen = 0
        rect = wx.Display(primaryScreen).GetClientArea()

        # Reset the form's size to be at least the specified minimum width
        self.SetSize(
            wx.Size(max(minWidth, width), min(max(minHeight, height),
                                              rect[3])))
        # Define the minimum size for this dialog as the current size
        self.SetSizeHints(max(minWidth, width),
                          min(max(minHeight, height), rect[3]))
        # Center the form on screen
        TransanaGlobal.CenterOnPrimary(self)

        # We need to set some minimum sizes so the sizers will work right
        self.kw_group_lb.SetSizeHints(minW=50, minH=20)
        self.kw_lb.SetSizeHints(minW=50, minH=20)
        self.ekw_lb.SetSizeHints(minW=50, minH=20)

        # We populate the Keyword Groups, Keywords, and Clip Keywords lists AFTER we determine the Form Size.
        # Long Keywords in the list were making the form too big!

        self.kw_groups = DBInterface.list_of_keyword_groups()
        for keywordGroup in self.kw_groups:
            self.kw_group_lb.Append(keywordGroup)

        # Populate the Keywords ListBox
        # Load the parent Collection in order to determine the default Keyword Group
        tempCollection = Collection.Collection(self.obj.collection_num)
        # Select the Collection Default Keyword Group in the Keyword Group list
        if (tempCollection.keyword_group !=
                '') and (self.kw_group_lb.FindString(
                    tempCollection.keyword_group) != wx.NOT_FOUND):
            self.kw_group_lb.SetStringSelection(tempCollection.keyword_group)
        # If no Default Keyword Group is defined, select the first item in the list
        else:
            # but only if there IS a first item.
            if len(self.kw_groups) > 0:
                self.kw_group_lb.SetSelection(0)
        # If there's a selected keyword group ...
        if self.kw_group_lb.GetSelection() != wx.NOT_FOUND:
            # populate the Keywords list
            self.kw_list = \
                DBInterface.list_of_keywords_by_group(self.kw_group_lb.GetStringSelection())
        else:
            # If not, create a blank one
            self.kw_list = []
        for keyword in self.kw_list:
            self.kw_lb.Append(keyword)

        # Populate the Quote Keywords ListBox
        # If the quote object has keywords ...
        for quoteKeyword in self.obj.keyword_list:
            # ... add them to the keyword list
            self.ekw_lb.Append(quoteKeyword.keywordPair)

        # Set initial focus to the Quote ID
        self.id_edit.SetFocus()
Пример #20
0
    def __init__(self, parent, id, title, clip_object, mergeList=None):
        # If no Merge List is passed in ...
        if mergeList == None:
            # ... use the default Clip Properties Dialog size passed in from the config object.  (This does NOT get saved.)
            size = TransanaGlobal.configData.clipPropertiesSize
            # ... we can enable Clip Change Propagation
            propagateEnabled = True
            HelpContext='Clip Properties'
        # If we DO have a merge list ...
        else:
            # ... increase the size of the dialog to allow for the list of mergeable clips.
            size = (TransanaGlobal.configData.clipPropertiesSize[0], TransanaGlobal.configData.clipPropertiesSize[1] + 130)
            # ... and Clip Change Propagation should be disabled
            propagateEnabled = False
            HelpContext='Clip Merge'

        # Make the Keyword Edit List resizable by passing wx.RESIZE_BORDER style.  Signal that Propogation is included.
        Dialogs.GenForm.__init__(self, parent, id, title, size=size, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
                                 propagateEnabled=propagateEnabled, useSizers = True, HelpContext=HelpContext)
        if mergeList == None:
            # Define the minimum size for this dialog as the initial size
            minWidth = 750
            minHeight = 570
        else:
            # Define the minimum size for this dialog as the initial size
            minWidth = 750
            minHeight = 650
        # Remember the Parent Window
        self.parent = parent
        # Remember the original Clip Object passed in
        self.obj = clip_object
        # Add a placeholder to the clip object for the merge clip number
        self.obj.mergeNumber = 0
        # Remember the merge list, if one is passed in
        self.mergeList = mergeList
        # Initialize the merge item as unselected
        self.mergeItemIndex = -1
        # if Keywords that server as Keyword Examples are removed, we will need to remember them.
        # Then, when OK is pressed, the Keyword Example references in the Database Tree can be removed.
        # We can't remove them immediately in case the whole Clip Properties Edit process is cancelled.
        self.keywordExamplesToDelete = []
        # Initialize a variable to hold merged keyword examples.
        self.mergedKeywordExamples = []

        # Create the form's main VERTICAL sizer
        mainSizer = wx.BoxSizer(wx.VERTICAL)

        # If we're merging Clips ...
        if self.mergeList != None:

            # ... display a label for the Merge Clips ...
            lblMergeClip = wx.StaticText(self.panel, -1, _("Clip to Merge"))
            mainSizer.Add(lblMergeClip, 0)
            
            # Add a vertical spacer to the main sizer        
            mainSizer.Add((0, 3))

            # Create a HORIZONTAL sizer for the merge information
            mergeSizer = wx.BoxSizer(wx.HORIZONTAL)
            
            # ... display a ListCtrl for the Merge Clips ...
            self.mergeClips = wx.ListCtrl(self.panel, -1, size=(300, 100), style=wx.LC_REPORT | wx.LC_SINGLE_SEL)
            # Add the element to the sizer
            mergeSizer.Add(self.mergeClips, 1, wx.EXPAND)
            # ... bind the Item Selected event for the List Control ...
            self.mergeClips.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected)

            # ... define the columns for the Merge Clips ...
            self.mergeClips.InsertColumn(0, _('Clip Name'))
            self.mergeClips.InsertColumn(1, _('Collection'))
            self.mergeClips.InsertColumn(2, _('Start Time'))
            self.mergeClips.InsertColumn(3, _('Stop Time'))
            self.mergeClips.SetColumnWidth(0, 244)
            self.mergeClips.SetColumnWidth(1, 244)
            # ... and populate the Merge Clips list from the mergeList data
            for (ClipNum, ClipID, CollectNum, CollectID, ClipStart, ClipStop, transcriptCount) in self.mergeList:
                index = self.mergeClips.InsertStringItem(sys.maxint, ClipID)
                self.mergeClips.SetStringItem(index, 1, CollectID)
                self.mergeClips.SetStringItem(index, 2, Misc.time_in_ms_to_str(ClipStart))
                self.mergeClips.SetStringItem(index, 3, Misc.time_in_ms_to_str(ClipStop))

            # Add the row sizer to the main vertical sizer
            mainSizer.Add(mergeSizer, 3, wx.EXPAND)

            # Add a vertical spacer to the main sizer        
            mainSizer.Add((0, 10))

        # Create a HORIZONTAL sizer for the first row
        r1Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v1 = wx.BoxSizer(wx.VERTICAL)
        # Clip ID
        self.id_edit = self.new_edit_box(_("Clip ID"), v1, self.obj.id, maxLen=100)
        # Add the element to the sizer
        r1Sizer.Add(v1, 1, wx.EXPAND)

        # Add a horizontal spacer to the row sizer        
        r1Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v2 = wx.BoxSizer(wx.VERTICAL)
        # Collection ID
        collection_edit = self.new_edit_box(_("Collection ID"), v2, self.obj.GetNodeString(False))
        # Add the element to the sizer
        r1Sizer.Add(v2, 2, wx.EXPAND)
        collection_edit.Enable(False)
        
        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r1Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))

        # Create a HORIZONTAL sizer for the next row
        r2Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v3 = wx.BoxSizer(wx.VERTICAL)
        # Series ID
        series_edit = self.new_edit_box(_("Series ID"), v3, self.obj.series_id)
        # Add the element to the sizer
        r2Sizer.Add(v3, 1, wx.EXPAND)
        series_edit.Enable(False)

        # Add a horizontal spacer to the row sizer        
        r2Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v4 = wx.BoxSizer(wx.VERTICAL)
        # Episode ID
        episode_edit = self.new_edit_box(_("Episode ID"), v4, self.obj.episode_id)
        # Add the element to the sizer
        r2Sizer.Add(v4, 1, wx.EXPAND)
        episode_edit.Enable(False)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r2Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))

        # Media Filename(s) [label]
        txt = wx.StaticText(self.panel, -1, _("Media Filename(s)"))
        mainSizer.Add(txt, 0)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 3))

        # Create a HORIZONTAL sizer for the next row
        r3Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Media Filename(s)
        # If the media filename path is not empty, we should normalize the path specification
        if self.obj.media_filename == '':
            filePath = self.obj.media_filename
        else:
            filePath = os.path.normpath(self.obj.media_filename)
        # Initialize the list of media filenames with the first one.
        self.filenames = [filePath]
        # For each additional Media file ...
        for vid in self.obj.additional_media_files:
            # ... add it to the filename list
            self.filenames.append(vid['filename'])
        self.fname_lb = wx.ListBox(self.panel, -1, wx.DefaultPosition, wx.Size(180, 60), self.filenames)
        r3Sizer.Add(self.fname_lb, 1, wx.EXPAND)
        self.fname_lb.SetDropTarget(ListBoxFileDropTarget(self.fname_lb))

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r3Sizer, 3, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))
        
        # Create a HORIZONTAL sizer for the next row
        r4Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v5 = wx.BoxSizer(wx.VERTICAL)
        # Clip Start.  Convert to HH:MM:SS.mm
        self.clip_start_edit = self.new_edit_box(_("Clip Start"), v5, Misc.time_in_ms_to_str(self.obj.clip_start))
        # Add the element to the sizer
        r4Sizer.Add(v5, 1, wx.EXPAND)
        # For merging, we need to remember the merged value of Clip Start
        self.clip_start = self.obj.clip_start
        self.clip_start_edit.Enable(False)

        # Add a horizontal spacer to the row sizer        
        r4Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v6 = wx.BoxSizer(wx.VERTICAL)
        # Clip Stop.  Convert to HH:MM:SS.mm
        self.clip_stop_edit = self.new_edit_box(_("Clip Stop"), v6, Misc.time_in_ms_to_str(self.obj.clip_stop))
        # Add the element to the sizer
        r4Sizer.Add(v6, 1, wx.EXPAND)
        # For merging, we need to remember the merged value of Clip Stop
        self.clip_stop = self.obj.clip_stop
        self.clip_stop_edit.Enable(False)

        # Add a horizontal spacer to the row sizer        
        r4Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v7 = wx.BoxSizer(wx.VERTICAL)
        # Clip Length.  Convert to HH:MM:SS.mm
        self.clip_length_edit = self.new_edit_box(_("Clip Length"), v7, Misc.time_in_ms_to_str(self.obj.clip_stop - self.obj.clip_start))
        # Add the element to the sizer
        r4Sizer.Add(v7, 1, wx.EXPAND)
        self.clip_length_edit.Enable(False)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r4Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))
        
        # Create a HORIZONTAL sizer for the next row
        r5Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v8 = wx.BoxSizer(wx.VERTICAL)
        # Comment
        comment_edit = self.new_edit_box(_("Comment"), v8, self.obj.comment, maxLen=255)
        # Add the element to the sizer
        r5Sizer.Add(v8, 1, wx.EXPAND)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r5Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))
        
        # Create a HORIZONTAL sizer for the next row
        r6Sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.text_edit = []

        # Notebook for holding Transcripts
        # ... we need to display them within a notebook ...
        self.notebook = wx.Notebook(self.panel, -1)
        # Add the element to the sizer
        r6Sizer.Add(self.notebook, 2, wx.EXPAND)
        
        # Initialize a list of notebook pages
        self.notebookPage = []
        # Initialize a counter for notebood pages
        counter = 0
        # Initialize the TRANSCRIPT start and stop time variables
        self.transcript_clip_start = []
        self.transcript_clip_stop = []
        # Iterate through the clip transcripts
        for tr in self.obj.transcripts:
            # Initialize the transcript start and stop time values for the individual transcripts
            self.transcript_clip_start.append(tr.clip_start)
            self.transcript_clip_stop.append(tr.clip_stop)
            # Create a panel for each notebook page
            self.notebookPage.append(wx.Panel(self.notebook))

            # Add the notebook page to the notebook ...
            self.notebook.AddPage(self.notebookPage[counter], _('Transcript') + " %d" % (counter + 1))
            # ... and use this page as the transcript object's parent
            transcriptParent = self.notebookPage[counter]
            
            # Clip Text

            # Load the Transcript into an RTF Control so the RTF Encoding won't show.
            # We use a list of edit controls to handle multiple transcripts.
            if TransanaConstants.USESRTC:
                self.text_edit.append(TranscriptEditor_RTC.TranscriptEditor(transcriptParent))
            else:
                self.text_edit.append(TranscriptEditor_STC.TranscriptEditor(transcriptParent))

            ##  DKW EXPERIMENT 4/5/2011
            self.text_edit[len(self.text_edit) - 1].load_transcript(self.obj.transcripts[counter])
                                                                    
            self.text_edit[len(self.text_edit) - 1].SetReadOnly(False)
            self.text_edit[len(self.text_edit) - 1].Enable(True)

            # Increment the counter
            counter += 1

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r6Sizer, 6, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))
        
        # Create a HORIZONTAL sizer for the next row
        r7Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v9 = wx.BoxSizer(wx.VERTICAL)
        # Keyword Group [label]
        txt = wx.StaticText(self.panel, -1, _("Keyword Group"))
        v9.Add(txt, 0, wx.BOTTOM, 3)

        # Keyword Group [list box]

        # Create an empty Keyword Group List for now.  We'll populate it later (for layout reasons)
        self.kw_groups = []
        self.kw_group_lb = wx.ListBox(self.panel, -1, choices = self.kw_groups)
        v9.Add(self.kw_group_lb, 1, wx.EXPAND)
        
        # Add the element to the sizer
        r7Sizer.Add(v9, 1, wx.EXPAND)

        # Create an empty Keyword List for now.  We'll populate it later (for layout reasons)
        self.kw_list = []
        wx.EVT_LISTBOX(self, self.kw_group_lb.GetId(), self.OnGroupSelect)

        # Add a horizontal spacer
        r7Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v10 = wx.BoxSizer(wx.VERTICAL)
        # Keyword [label]
        txt = wx.StaticText(self.panel, -1, _("Keyword"))
        v10.Add(txt, 0, wx.BOTTOM, 3)

        # Keyword [list box]
        self.kw_lb = wx.ListBox(self.panel, -1, choices = self.kw_list, style=wx.LB_EXTENDED)
        v10.Add(self.kw_lb, 1, wx.EXPAND)

        wx.EVT_LISTBOX_DCLICK(self, self.kw_lb.GetId(), self.OnAddKW)

        # Add the element to the sizer
        r7Sizer.Add(v10, 1, wx.EXPAND)

        # Add a horizontal spacer
        r7Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v11 = wx.BoxSizer(wx.VERTICAL)
        # Keyword transfer buttons
        add_kw = wx.Button(self.panel, wx.ID_FILE2, ">>", wx.DefaultPosition)
        v11.Add(add_kw, 0, wx.EXPAND | wx.TOP, 20)
        wx.EVT_BUTTON(self, wx.ID_FILE2, self.OnAddKW)

        rm_kw = wx.Button(self.panel, wx.ID_FILE3, "<<", wx.DefaultPosition)
        v11.Add(rm_kw, 0, wx.EXPAND | wx.TOP, 10)
        wx.EVT_BUTTON(self, wx.ID_FILE3, self.OnRemoveKW)

        kwm = wx.BitmapButton(self.panel, wx.ID_FILE4, TransanaImages.KWManage.GetBitmap())
        v11.Add(kwm, 0, wx.EXPAND | wx.TOP, 10)
        # Add a spacer to increase the height of the Keywords section
##        v11.Add((0, 60))
        kwm.SetToolTipString(_("Keyword Management"))
        wx.EVT_BUTTON(self, wx.ID_FILE4, self.OnKWManage)

        # Add the element to the sizer
        r7Sizer.Add(v11, 0)

        # Add a horizontal spacer
        r7Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v12 = wx.BoxSizer(wx.VERTICAL)

        # Clip Keywords [label]
        txt = wx.StaticText(self.panel, -1, _("Clip Keywords"))
        v12.Add(txt, 0, wx.BOTTOM, 3)

        # Clip Keywords [list box]
        # Create an empty ListBox.  We'll populate it later for layout reasons.
        self.ekw_lb = wx.ListBox(self.panel, -1, style=wx.LB_EXTENDED)
        v12.Add(self.ekw_lb, 1, wx.EXPAND)

        self.ekw_lb.Bind(wx.EVT_KEY_DOWN, self.OnKeywordKeyDown)

        # Add the element to the sizer
        r7Sizer.Add(v12, 2, wx.EXPAND)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r7Sizer, 8, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))
        
        # Create a sizer for the buttons
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        # Add the buttons
        self.create_buttons(sizer=btnSizer)
        # Add the button sizer to the main sizer
        mainSizer.Add(btnSizer, 0, wx.EXPAND)

        # Because of the way Clips are created (with Drag&Drop / Cut&Paste functions), we have to trap the missing
        # ID error here.  Therefore, we need to override the EVT_BUTTON for the OK Button.
        # Since we don't have an object for the OK Button, we use FindWindowById to find it based on its ID.
        self.Bind(wx.EVT_BUTTON, self.OnOK, self.FindWindowById(wx.ID_OK))
        # We also need to intercept the Cancel button.
        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.FindWindowById(wx.ID_CANCEL))

        self.Bind(wx.EVT_SIZE, self.OnSize)

        # Set the PANEL's main sizer
        self.panel.SetSizer(mainSizer)
        # Tell the PANEL to auto-layout
        self.panel.SetAutoLayout(True)
        # Lay out the Panel
        self.panel.Layout()
        # Lay out the panel on the form
        self.Layout()
        # Resize the form to fit the contents
        self.Fit()

        # Get the new size of the form
        (width, height) = self.GetSizeTuple()
        # Determine which monitor to use and get its size and position
        if TransanaGlobal.configData.primaryScreen < wx.Display.GetCount():
            primaryScreen = TransanaGlobal.configData.primaryScreen
        else:
            primaryScreen = 0
        rect = wx.Display(primaryScreen).GetClientArea()

        # Reset the form's size to be at least the specified minimum width
        self.SetSize(wx.Size(max(minWidth, width), min(max(minHeight, height), rect[3])))
        # Define the minimum size for this dialog as the current size
        self.SetSizeHints(max(minWidth, width), min(max(minHeight, height), rect[3]))
        # Center the form on screen
        self.CenterOnScreen()

        # We need to set some minimum sizes so the sizers will work right
        self.kw_group_lb.SetSizeHints(minW = 50, minH = 20)
        self.kw_lb.SetSizeHints(minW = 50, minH = 20)
        self.ekw_lb.SetSizeHints(minW = 50, minH = 20)

        # We populate the Keyword Groups, Keywords, and Clip Keywords lists AFTER we determine the Form Size.
        # Long Keywords in the list were making the form too big!

        self.kw_groups = DBInterface.list_of_keyword_groups()
        for keywordGroup in self.kw_groups:
            self.kw_group_lb.Append(keywordGroup)

        # Populate the Keywords ListBox
        # Load the parent Collection in order to determine the default Keyword Group
        tempCollection = Collection.Collection(self.obj.collection_num)
        # Select the Collection Default Keyword Group in the Keyword Group list
        if (tempCollection.keyword_group != '') and (self.kw_group_lb.FindString(tempCollection.keyword_group) != wx.NOT_FOUND):
            self.kw_group_lb.SetStringSelection(tempCollection.keyword_group)
        # If no Default Keyword Group is defined, select the first item in the list
        else:
            # but only if there IS a first item.
            if len(self.kw_groups) > 0:
                self.kw_group_lb.SetSelection(0)
        # If there's a selected keyword group ...
        if self.kw_group_lb.GetSelection() != wx.NOT_FOUND:
            # populate the Keywords list
            self.kw_list = \
                DBInterface.list_of_keywords_by_group(self.kw_group_lb.GetStringSelection())
        else:
            # If not, create a blank one
            self.kw_list = []
        for keyword in self.kw_list:
            self.kw_lb.Append(keyword)

        # Populate the Clip Keywords ListBox
        # If the clip object has keywords ... 
        for clipKeyword in self.obj.keyword_list:
            # ... add them to the keyword list
            self.ekw_lb.Append(clipKeyword.keywordPair)

        # If we have a Notebook of text controls ...
        if self.notebookPage:
            # ... interate through the text controls ...
            for textCtrl in self.text_edit:
                # ... and set them to the size of the notebook page.
                textCtrl.SetSize(self.notebookPage[0].GetSizeTuple())

        # Set initial focus to the Clip ID
        self.id_edit.SetFocus()
Пример #21
0
    def __init__(self, parent, id, title, document_object):
        """ Create the Transcript Properties form """
        self.parent = parent
        self.width = 500
        self.height = 260
        # Make the Keyword Edit List resizable by passing wx.RESIZE_BORDER style
        Dialogs.GenForm.__init__(self,
                                 parent,
                                 id,
                                 title,
                                 size=(self.width, self.height),
                                 style=wx.DEFAULT_DIALOG_STYLE
                                 | wx.RESIZE_BORDER,
                                 useSizers=True,
                                 HelpContext='Document Properties')

        # Define the form's main object
        self.obj = document_object
        # if a Library has been passed in ...
        if self.obj.library_num > 0:
            # ... get the Library's data
            library = Library.Library(self.obj.library_num)
        # If no Library has been passed in (ILLEGAL??) ...
        else:
            # ... create an empty Library
            library = Library.Library()

        # Create the form's main VERTICAL sizer
        mainSizer = wx.BoxSizer(wx.VERTICAL)

        # Create a VERTICAL sizer for the next element
        v1 = wx.BoxSizer(wx.VERTICAL)
        # Add the Transcript ID element
        self.id_edit = self.new_edit_box(_("Document ID"),
                                         v1,
                                         self.obj.id,
                                         maxLen=100)
        # Add the element to the sizer
        mainSizer.Add(v1, 1, wx.EXPAND)

        # Add a vertical spacer to the main sizer
        mainSizer.Add((0, 10))

        # Create a VERTICAL sizer for the next element
        v2 = wx.BoxSizer(wx.VERTICAL)
        # Add the Library ID element
        library_id_edit = self.new_edit_box(_("Library ID"), v2, library.id)
        # Add the element to the main sizer
        mainSizer.Add(v2, 1, wx.EXPAND)
        # Disable Library ID
        library_id_edit.Enable(False)

        # Add a vertical spacer to the main sizer
        mainSizer.Add((0, 10))

        # If the Document has already been defined, we can skip this!
        if self.obj.number == 0:
            # Create a HORIZONTAL sizer for the next row
            r1Sizer = wx.BoxSizer(wx.HORIZONTAL)

            # Create a VERTICAL sizer for the next element
            v3 = wx.BoxSizer(wx.VERTICAL)
            # Add the Import File element
            self.rtfname_edit = self.new_edit_box(
                _("DOCX/RTF/XML/TXT File to import  (optional)"), v3, '')
            # Make this text box a File Drop Target
            self.rtfname_edit.SetDropTarget(
                EditBoxFileDropTarget(self.rtfname_edit))
            # Add the element to the row sizer
            r1Sizer.Add(v3, 1, wx.EXPAND)

            # Add a horizontal spacer to the row sizer
            r1Sizer.Add((10, 0))

            # Add the Browse Button
            browse = wx.Button(self.panel, -1, _("Browse"))
            # Add the Browse Method to the Browse Button
            wx.EVT_BUTTON(self, browse.GetId(), self.OnBrowseClick)
            # Add the element to the sizer
            r1Sizer.Add(browse, 0, wx.ALIGN_BOTTOM)
            # If Mac ...
            if 'wxMac' in wx.PlatformInfo:
                # ... add a spacer to avoid control clipping
                r1Sizer.Add((2, 0))

            # Add the row sizer to the main vertical sizer
            mainSizer.Add(r1Sizer, 0, wx.EXPAND)

            # Add a vertical spacer to the main sizer
            mainSizer.Add((0, 10))

        else:
            # Create a HORIZONTAL sizer for the next row
            r1Sizer = wx.BoxSizer(wx.HORIZONTAL)
            # Create a VERTICAL sizer for the next element
            v3 = wx.BoxSizer(wx.VERTICAL)
            # Add the Import File element
            self.rtfname_edit = self.new_edit_box(_("Imported File"), v3,
                                                  self.obj.imported_file)
            # Disable this field
            self.rtfname_edit.Enable(False)
            # Add the element to the row sizer
            r1Sizer.Add(v3, 4, wx.EXPAND)

            # Add a horizontal spacer to the row sizer
            r1Sizer.Add((10, 0))

            # Create a VERTICAL sizer for the next element
            v35 = wx.BoxSizer(wx.VERTICAL)
            # If the import date is a datetime object ...
            if isinstance(self.obj.import_date, datetime.datetime):
                # ... get its YYYY-MM-DD representation
                dtStr = self.obj.import_date.strftime('%Y-%m-%d')
            # if the import date is None ...
            elif self.obj.import_date is None:
                # ... leave this field blank
                dtStr = ''
            # Otherwise ...
            else:
                # Use whatever the import date value is
                dtStr = self.obj.import_date
            # If no file was imported ...
            if self.obj.imported_file == '':
                # ... the date is the Document Creation Date
                prompt = _("Creation Date")
            # If a file was imported ...
            else:
                # ... the date is the Document Import Date
                prompt = _("Import Date")
            # Add the Import Date element
            self.import_date = self.new_edit_box(prompt, v35, dtStr)
            # Disable this field
            self.import_date.Enable(False)
            # Add the element to the row sizer
            r1Sizer.Add(v35, 1, wx.EXPAND)

            # Add the row sizer to the main vertical sizer
            mainSizer.Add(r1Sizer, 0, wx.EXPAND)

            # Add a vertical spacer to the main sizer
            mainSizer.Add((0, 10))

        # Create a VERTICAL sizer for the next element
        v4 = wx.BoxSizer(wx.VERTICAL)
        # Add the Author element
        author_edit = self.new_edit_box(_("Author"),
                                        v4,
                                        self.obj.author,
                                        maxLen=100)
        # Add the element to the main sizer
        mainSizer.Add(v4, 1, wx.EXPAND)

        # Add a vertical spacer to the main sizer
        mainSizer.Add((0, 10))

        # Create a VERTICAL sizer for the next element
        v5 = wx.BoxSizer(wx.VERTICAL)
        # Add the Comment element
        comment_edit = self.new_edit_box(_("Comment"),
                                         v5,
                                         self.obj.comment,
                                         maxLen=255)
        # Add the element to the main sizer
        mainSizer.Add(v5, 1, wx.EXPAND)

        # Add a vertical spacer to the main sizer
        mainSizer.Add((0, 10))

        # Create a HORIZONTAL sizer for the next row
        r2Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v6 = wx.BoxSizer(wx.VERTICAL)
        # Keyword Group [label]
        txt = wx.StaticText(self.panel, -1, _("Keyword Group"))
        v6.Add(txt, 0, wx.BOTTOM, 3)

        # Keyword Group [list box]

        kw_groups_id = wx.NewId()
        # Create an empty Keyword Group List for now.  We'll populate it later (for layout reasons)
        self.kw_groups = []
        self.kw_group_lb = wx.ListBox(self.panel, kw_groups_id,
                                      wx.DefaultPosition, wx.DefaultSize,
                                      self.kw_groups)
        v6.Add(self.kw_group_lb, 1, wx.EXPAND)

        # Add the element to the sizer
        r2Sizer.Add(v6, 1, wx.EXPAND)

        self.kw_list = []
        wx.EVT_LISTBOX(self, kw_groups_id, self.OnGroupSelect)

        # Add a horizontal spacer
        r2Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v7 = wx.BoxSizer(wx.VERTICAL)
        # Keyword [label]
        txt = wx.StaticText(self.panel, -1, _("Keyword"))
        v7.Add(txt, 0, wx.BOTTOM, 3)

        # Keyword [list box]
        self.kw_lb = wx.ListBox(self.panel,
                                -1,
                                wx.DefaultPosition,
                                wx.DefaultSize,
                                self.kw_list,
                                style=wx.LB_EXTENDED)
        v7.Add(self.kw_lb, 1, wx.EXPAND)

        wx.EVT_LISTBOX_DCLICK(self, self.kw_lb.GetId(), self.OnAddKW)

        # Add the element to the sizer
        r2Sizer.Add(v7, 1, wx.EXPAND)

        # Add a horizontal spacer
        r2Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v8 = wx.BoxSizer(wx.VERTICAL)
        # Keyword transfer buttons
        add_kw = wx.Button(self.panel, wx.ID_FILE2, ">>", wx.DefaultPosition)
        v8.Add(add_kw, 0, wx.EXPAND | wx.TOP, 20)
        wx.EVT_BUTTON(self, wx.ID_FILE2, self.OnAddKW)

        rm_kw = wx.Button(self.panel, wx.ID_FILE3, "<<", wx.DefaultPosition)
        v8.Add(rm_kw, 0, wx.EXPAND | wx.TOP, 10)
        wx.EVT_BUTTON(self, wx.ID_FILE3, self.OnRemoveKW)

        kwm = wx.BitmapButton(self.panel, wx.ID_FILE4,
                              TransanaImages.KWManage.GetBitmap())
        v8.Add(kwm, 0, wx.EXPAND | wx.TOP, 10)
        # Add a spacer to increase the height of the Keywords section
        v8.Add((0, 60))
        kwm.SetToolTipString(_("Keyword Management"))
        wx.EVT_BUTTON(self, wx.ID_FILE4, self.OnKWManage)

        # Add the element to the sizer
        r2Sizer.Add(v8, 0)

        # Add a horizontal spacer
        r2Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v9 = wx.BoxSizer(wx.VERTICAL)

        # Episode Keywords [label]
        txt = wx.StaticText(self.panel, -1, _("Document Keywords"))
        v9.Add(txt, 0, wx.BOTTOM, 3)

        # Episode Keywords [list box]

        # Create an empty ListBox
        self.ekw_lb = wx.ListBox(self.panel,
                                 -1,
                                 wx.DefaultPosition,
                                 wx.DefaultSize,
                                 style=wx.LB_EXTENDED)
        v9.Add(self.ekw_lb, 1, wx.EXPAND)

        self.ekw_lb.Bind(wx.EVT_KEY_DOWN, self.OnKeywordKeyDown)

        # Add the element to the sizer
        r2Sizer.Add(v9, 2, wx.EXPAND)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r2Sizer, 5, wx.EXPAND)

        # Add a vertical spacer to the main sizer
        mainSizer.Add((0, 10))

        # Create a sizer for the buttons
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        # Add the buttons
        self.create_buttons(sizer=btnSizer)
        # Add the button sizer to the main sizer
        mainSizer.Add(btnSizer, 0, wx.EXPAND)
        # If Mac ...
        if 'wxMac' in wx.PlatformInfo:
            # ... add a spacer to avoid control clipping
            mainSizer.Add((0, 2))

        # Set the PANEL's main sizer
        self.panel.SetSizer(mainSizer)
        # Tell the PANEL to auto-layout
        self.panel.SetAutoLayout(True)
        # Lay out the Panel
        self.panel.Layout()
        # Lay out the Form
        self.Layout()
        # Resize the form to fit the contents
        self.Fit()

        # Get the new size of the form
        (width, height) = self.GetSizeTuple()
        # Reset the form's size to be at least the specified minimum width
        self.SetSize(wx.Size(max(self.width, width), height))
        # Define the minimum size for this dialog as the current size, and define height as unchangeable
        self.SetSizeHints(max(self.width, width), height, -1, height)
        # Center the form on screen
        TransanaGlobal.CenterOnPrimary(self)

        # We need to set some minimum sizes so the sizers will work right
        self.kw_group_lb.SetSizeHints(minW=50, minH=20)
        self.kw_lb.SetSizeHints(minW=50, minH=20)
        self.ekw_lb.SetSizeHints(minW=50, minH=20)

        # We populate the Keyword Groups, Keywords, and Clip Keywords lists AFTER we determine the Form Size.
        # Long Keywords in the list were making the form too big!

        self.kw_groups = DBInterface.list_of_keyword_groups()
        for keywordGroup in self.kw_groups:
            self.kw_group_lb.Append(keywordGroup)

        # Select the Library Default Keyword Group in the Keyword Group list
        if (library.keyword_group != '') and (self.kw_group_lb.FindString(
                library.keyword_group) != wx.NOT_FOUND):
            self.kw_group_lb.SetStringSelection(library.keyword_group)
        # If no Default Keyword Group is defined, select the first item in the list
        else:
            # but only if there IS a first item in the list.
            if len(self.kw_groups) > 0:
                self.kw_group_lb.SetSelection(0)
        if self.kw_group_lb.GetSelection() != wx.NOT_FOUND:
            self.kw_list = \
                DBInterface.list_of_keywords_by_group(self.kw_group_lb.GetStringSelection())
        else:
            self.kw_list = []
        for keyword in self.kw_list:
            self.kw_lb.Append(keyword)

        # Populate the ListBox
        for documentKeyword in self.obj.keyword_list:
            self.ekw_lb.Append(documentKeyword.keywordPair)

        # This is bad.  Sorry.
        # Create a hidden RichTextEditCtrl to use for importing data
        self.hiddenRTC = RichTextEditCtrl_RTC.RichTextEditCtrl(self)
        # This control should NOT be visible
        self.hiddenRTC.Show(False)

        # Set focus to the Transcript ID
        self.id_edit.SetFocus()
Пример #22
0
    def __init__(self, parent=None, direc=None, wildcard='*', multiple=True):
        """
        file selector dialog with unix-style wildcard

        direc: starting directory
        wildcard: unix-style wildcard
        multiple: style

        use like
        >>> dlg = FileSelectorDialog()
        >>> if dlg.ShowModal() == wx.ID_OK:
        >>>     fns = dlg.GetPaths()
        """

        if not direc:
            direc = os.getcwd()
        self.direc = os.path.abspath(direc)
        self.fnPat = wildcard
        self.multiple = multiple

        wx.Dialog.__init__(self, parent, -1, title='')

        sizer = wx.BoxSizer(wx.VERTICAL)

        hsz = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(hsz, 0, wx.EXPAND)

        self.up_button = wx.Button(self, wx.ID_UP, style=wx.BU_EXACTFIT)
        hsz.Add(self.up_button)
        wx.EVT_BUTTON(self, self.up_button.GetId(), self.onUp)

        self.txt = wx.TextCtrl(self, wx.ID_ANY,
                               os.path.join(self.direc, self.fnPat))
        hsz.Add(self.txt, 1, wx.EXPAND | wx.ALL, 2)
        wx.EVT_TEXT(self, self.txt.GetId(), self.refreshList)

        hsz = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(hsz, 0, wx.EXPAND)

        if self.multiple:
            style = wx.LB_EXTENDED | wx.LB_NEEDED_SB | wx.LB_HSCROLL
        else:
            style = wx.LB_SINGLE | wx.LB_NEEDED_SB | wx.LB_HSCROLL
        self.lb = wx.ListBox(self, wx.ID_ANY, size=(350, 400), style=style)
        sizer.Add(self.lb, 1, wx.EXPAND | wx.ALL, 5)

        wx.EVT_LISTBOX_DCLICK(self, self.lb.GetId(), self.onDClick)

        bsz = wx.StdDialogButtonSizer()
        sizer.Add(bsz, 0, wx.EXPAND)

        button = wx.Button(self, wx.ID_CANCEL)
        bsz.AddButton(button)

        button = wx.Button(self, wx.ID_OK)
        bsz.AddButton(button)

        bsz.Realize()

        ll = self.txt.GetLastPosition()
        self.txt.SetInsertionPoint(ll)

        self.refreshList(None)

        self.SetSizer(sizer)
        sizer.Fit(self)
Пример #23
0
    def __init__(self, parent, id, title, obj, keywords):
        # Make the Keyword Edit List resizable by passing wx.RESIZE_BORDER style
        Dialogs.GenForm.__init__(
            self,
            parent,
            id,
            title,
            size=TransanaGlobal.configData.keywordListEditSize,
            style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
            useSizers=True,
            HelpContext='Edit Keywords')

        # Remember the parent Window
        self.parent = parent
        self.obj = obj
        # if Keywords that server as Keyword Examples are removed, we will need to remember them.
        # Then, when OK is pressed, the Keyword Example references in the Database Tree can be removed.
        # We can't remove them immediately in case the whole Clip Properties Edit process is cancelled.
        self.keywordExamplesToDelete = []

        # COPY the keyword list, rather than just pointing to it, so that the list on this form will
        # be independent of the original list.  That way, pressing CANCEL does not cause the list to
        # be changed anyway, though it means that if OK is pressed, you must copy the list to update
        # it in the calling routine.
        self.keywords = []
        for kws in keywords:
            self.keywords.append(kws)

        # Create the form's main VERTICAL sizer
        mainSizer = wx.BoxSizer(wx.VERTICAL)

        # Create a HORIZONTAL sizer for the first row
        r1Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v1 = wx.BoxSizer(wx.VERTICAL)
        # Keyword Group [label]
        txt = wx.StaticText(self.panel, -1, _("Keyword Group"))
        v1.Add(txt, 0, wx.BOTTOM, 3)

        # Keyword Group layout [list box]

        # Create an empty Keyword Group List for now.  We'll populate it later (for layout reasons)
        self.kw_groups = []
        self.kw_group_lb = wx.ListBox(self.panel, 101, wx.DefaultPosition,
                                      wx.DefaultSize, self.kw_groups)
        v1.Add(self.kw_group_lb, 1, wx.EXPAND)

        # Add the element to the sizer
        r1Sizer.Add(v1, 1, wx.EXPAND)

        self.kw_list = []
        wx.EVT_LISTBOX(self, 101, self.OnGroupSelect)

        # Add a horizontal spacer
        r1Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v2 = wx.BoxSizer(wx.VERTICAL)
        # Keyword [label]
        txt = wx.StaticText(self.panel, -1, _("Keyword"))
        v2.Add(txt, 0, wx.BOTTOM, 3)

        # Keyword [list box]
        self.kw_lb = wx.ListBox(self.panel,
                                -1,
                                wx.DefaultPosition,
                                wx.DefaultSize,
                                self.kw_list,
                                style=wx.LB_EXTENDED)
        v2.Add(self.kw_lb, 1, wx.EXPAND)

        wx.EVT_LISTBOX_DCLICK(self, self.kw_lb.GetId(), self.OnAddKW)

        # Add the element to the sizer
        r1Sizer.Add(v2, 1, wx.EXPAND)

        # Add a horizontal spacer
        r1Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v3 = wx.BoxSizer(wx.VERTICAL)
        # Keyword transfer buttons
        add_kw = wx.Button(self.panel, wx.ID_FILE2, ">>", wx.DefaultPosition)
        v3.Add(add_kw, 0, wx.EXPAND | wx.TOP, 20)
        wx.EVT_BUTTON(self, wx.ID_FILE2, self.OnAddKW)

        rm_kw = wx.Button(self.panel, wx.ID_FILE3, "<<", wx.DefaultPosition)
        v3.Add(rm_kw, 0, wx.EXPAND | wx.TOP, 10)
        wx.EVT_BUTTON(self, wx.ID_FILE3, self.OnRemoveKW)

        kwm = wx.BitmapButton(self.panel, wx.ID_FILE4,
                              TransanaImages.KWManage.GetBitmap())
        v3.Add(kwm, 0, wx.EXPAND | wx.TOP, 10)
        # Add a spacer to increase the height of the Keywords section
        v3.Add((0, 60))
        kwm.SetToolTipString(_("Keyword Management"))
        wx.EVT_BUTTON(self, wx.ID_FILE4, self.OnKWManage)

        # Add the element to the sizer
        r1Sizer.Add(v3, 0)

        # Add a horizontal spacer
        r1Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v4 = wx.BoxSizer(wx.VERTICAL)
        # Keywords [label]
        txt = wx.StaticText(self.panel, -1, _("Keywords"))
        v4.Add(txt, 0, wx.BOTTOM, 3)

        # Keywords [list box]
        # Create an empty ListBox
        self.ekw_lb = wx.ListBox(self.panel,
                                 -1,
                                 wx.DefaultPosition,
                                 wx.DefaultSize,
                                 style=wx.LB_EXTENDED)
        v4.Add(self.ekw_lb, 1, wx.EXPAND)
        self.ekw_lb.Bind(wx.EVT_KEY_DOWN, self.OnKeywordKeyDown)

        # Add the element to the sizer
        r1Sizer.Add(v4, 2, wx.EXPAND)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r1Sizer, 1, wx.EXPAND)

        # Add a vertical spacer to the main sizer
        mainSizer.Add((0, 10))

        # Create a sizer for the buttons
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        # Add the buttons
        self.create_buttons(sizer=btnSizer)
        # Add the button sizer to the main sizer
        mainSizer.Add(btnSizer, 0, wx.EXPAND)
        # If Mac ...
        if 'wxMac' in wx.PlatformInfo:
            # ... add a spacer to avoid control clipping
            mainSizer.Add((0, 2))

        # Set the PANEL's main sizer
        self.panel.SetSizer(mainSizer)
        # Tell the PANEL to auto-layout
        self.panel.SetAutoLayout(True)
        # Lay out the Panel
        self.panel.Layout()
        # Lay out the panel on the form
        self.Layout()
        # Resize the form to fit the contents
        self.Fit()

        # Get the new size of the form
        (width, height) = self.GetSizeTuple()
        # Reset the form's size to be at least the specified minimum width
        self.SetSize(wx.Size(max(600, width), max(385, height)))
        # Define the minimum size for this dialog as the current size
        self.SetSizeHints(max(600, width), max(385, height))
        # Center the form on screen
        TransanaGlobal.CenterOnPrimary(self)

        # We need to set some minimum sizes so the sizers will work right
        self.kw_group_lb.SetSizeHints(minW=50, minH=20)
        self.kw_lb.SetSizeHints(minW=50, minH=20)
        self.ekw_lb.SetSizeHints(minW=50, minH=20)

        # We need to capture the OK and Cancel button clicks locally.  We'll use FindWindowByID to locate the correct widgets.
        self.Bind(wx.EVT_BUTTON, self.OnOK, self.FindWindowById(wx.ID_OK))
        self.Bind(wx.EVT_BUTTON, self.OnCancel,
                  self.FindWindowById(wx.ID_CANCEL))

        # We populate the Keyword Groups, Keywords, and Clip Keywords lists AFTER we determine the Form Size.
        # Long Keywords in the list were making the form too big!

        # Obtain the list of Keyword Groups
        self.kw_groups = DBInterface.list_of_keyword_groups()
        for keywordGroup in self.kw_groups:
            self.kw_group_lb.Append(keywordGroup)
        if self.kw_group_lb.GetCount() > 0:
            self.kw_group_lb.EnsureVisible(0)

        # Get the Parent Object, so we can know the Default Keyword Group
        if isinstance(self.obj, Episode.Episode):
            objParent = Library.Library(self.obj.series_num)
        elif isinstance(self.obj, Document.Document):
            objParent = Library.Library(self.obj.library_num)
        elif isinstance(self.obj, Clip.Clip) or isinstance(
                self.obj, Snapshot.Snapshot) or isinstance(
                    self.obj, Quote.Quote):
            objParent = Collection.Collection(self.obj.collection_num)
        if len(self.kw_groups) > 0:
            # Set the Keyword Group to the Default keyword Group
            if self.kw_group_lb.FindString(
                    objParent.keyword_group) != wx.NOT_FOUND:
                self.kw_group_lb.SetStringSelection(objParent.keyword_group)
            else:
                self.kw_group_lb.SetSelection(0)
            # Obtain the list of Keywords for the intial Keyword Group
            self.kw_list = DBInterface.list_of_keywords_by_group(
                self.kw_group_lb.GetStringSelection())
        else:
            self.kw_list = []
        for keyword in self.kw_list:
            self.kw_lb.Append(keyword)
        if self.kw_lb.GetCount() > 0:
            self.kw_lb.EnsureVisible(0)

        # Populate the ListBox
        for clipKeyword in self.keywords:
            self.ekw_lb.Append(clipKeyword.keywordPair)
        if self.ekw_lb.GetCount() > 0:
            self.ekw_lb.EnsureVisible(0)

        self.kw_group_lb.SetFocus()
Пример #24
0
    def __init__(self, parent, defaultKWGroup=None, deleteEnabled=True):
        """Initialize a KWManager object."""
        # Remember the value for deleteEnabled
        self.deleteEnabled = deleteEnabled
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           _("Keyword Management"),
                           wx.DefaultPosition,
                           wx.Size(550, 420),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        # To look right, the Mac needs the Small Window Variant.
        if "__WXMAC__" in wx.PlatformInfo:
            self.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)

        # Define the minimum size for this dialog as the initial size
        self.SetSizeHints(550, 420)

        # Create the form's main VERTICAL sizer
        mainSizer = wx.BoxSizer(wx.VERTICAL)

        # Keyword Group
        txt = wx.StaticText(self, -1, _("Keyword Group"))
        mainSizer.Add(txt, 0, wx.LEFT | wx.RIGHT | wx.TOP, 10)
        mainSizer.Add((0, 3))

        # Create a HORIZONTAL sizer for the first row
        r1Sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.kw_group = wx.Choice(self, 101, wx.DefaultPosition,
                                  wx.DefaultSize, [])
        r1Sizer.Add(self.kw_group, 5, wx.EXPAND)
        wx.EVT_CHOICE(self, 101, self.OnGroupSelect)

        r1Sizer.Add((10, 0))

        # Create a new Keyword Group button
        new_kwg = wx.Button(self, wx.ID_FILE1, _("Create a New Keyword Group"))
        r1Sizer.Add(new_kwg, 3, wx.EXPAND)
        wx.EVT_BUTTON(self, wx.ID_FILE1, self.OnNewKWG)

        mainSizer.Add(r1Sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 10)

        mainSizer.Add((0, 10))

        # Keywords label+listbox
        txt = wx.StaticText(self, -1, _("Keywords"))
        mainSizer.Add(txt, 0, wx.LEFT, 10)

        # Create a HORIZONTAL sizer for the first row
        r2Sizer = wx.BoxSizer(wx.HORIZONTAL)

        v1 = wx.BoxSizer(wx.VERTICAL)
        if 'wxMac' in wx.PlatformInfo:
            style = wx.LB_SINGLE
        else:
            style = wx.LB_SINGLE | wx.LB_SORT
        self.kw_lb = wx.ListBox(self,
                                100,
                                wx.DefaultPosition,
                                wx.DefaultSize, [],
                                style=style)
        v1.Add(self.kw_lb, 1, wx.EXPAND)
        wx.EVT_LISTBOX(self, 100, self.OnKeywordSelect)
        wx.EVT_LISTBOX_DCLICK(self, 100, self.OnKeywordDoubleClick)

        r2Sizer.Add(v1, 5, wx.EXPAND)
        r2Sizer.Add((10, 0))

        v2 = wx.BoxSizer(wx.VERTICAL)
        # Add Keyword to List button
        add_kw = wx.Button(self, wx.ID_FILE2, _("Add Keyword to List"))
        v2.Add(add_kw, 0, wx.EXPAND | wx.BOTTOM, 10)
        wx.EVT_BUTTON(self, wx.ID_FILE2, self.OnAddKW)

        # Edit Keyword button
        self.edit_kw = wx.Button(self, -1, _("Edit Keyword"))
        v2.Add(self.edit_kw, 0, wx.EXPAND | wx.BOTTOM, 10)
        wx.EVT_BUTTON(self, self.edit_kw.GetId(), self.OnEditKW)
        self.edit_kw.Enable(False)

        # Delete Keyword from List button
        self.del_kw = wx.Button(self, wx.ID_FILE3,
                                _("Delete Keyword from List"))
        v2.Add(self.del_kw, 0, wx.EXPAND | wx.BOTTOM, 10)
        wx.EVT_BUTTON(self, wx.ID_FILE3, self.OnDelKW)
        self.del_kw.Enable(False)

        # Definition box
        def_txt = wx.StaticText(self, -1, _("Definition"))
        v2.Add(def_txt, 0, wx.BOTTOM, 3)

        self.definition = wx.TextCtrl(self, -1, '', style=wx.TE_MULTILINE)
        v2.Add(self.definition, 1, wx.EXPAND | wx.BOTTOM, 10)
        self.definition.Enable(False)

        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        # Dialog Close button
        close = wx.Button(self, wx.ID_CLOSE, _("Close"))
        btnSizer.Add(close, 1, wx.EXPAND | wx.RIGHT, 10)
        close.SetDefault()
        wx.EVT_BUTTON(self, wx.ID_CLOSE, self.OnClose)

        # We don't want to use wx.ID_HELP here, as that causes the Help buttons to be replaced with little question
        # mark buttons on the Mac, which don't look good.
        ID_HELP = wx.NewId()

        # Dialog Help button
        helpBtn = wx.Button(self, ID_HELP, _("Help"))
        btnSizer.Add(helpBtn, 1, wx.EXPAND)
        wx.EVT_BUTTON(self, ID_HELP, self.OnHelp)

        v2.Add(btnSizer, 0, wx.EXPAND)

        r2Sizer.Add(v2, 3, wx.EXPAND)

        mainSizer.Add(r2Sizer, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
                      10)

        self.SetSizer(mainSizer)
        self.SetAutoLayout(True)
        self.Layout()
        TransanaGlobal.CenterOnPrimary(self)

        self.kw_groups = DBInterface.list_of_keyword_groups()
        for kwg in self.kw_groups:
            self.kw_group.Append(kwg)

        if len(self.kw_groups) > 0:
            if defaultKWGroup != None:
                selPos = self.kw_group.FindString(defaultKWGroup)
            else:
                selPos = 0
            self.kw_group.SetSelection(selPos)
            self.kw_list = DBInterface.list_of_keywords_by_group(
                self.kw_group.GetString(selPos))
        else:
            self.kw_list = []

        for kw in self.kw_list:
            self.kw_lb.Append(kw)

        if len(self.kw_list) > 0:
            self.kw_lb.SetSelection(0, False)

        self.ShowModal()
Пример #25
0
	def AutoReload(self, event):
		if(self.downloading == True):
			if(self.downloader.taille_bloc != 0):
				self.nb_blocs_max = self.downloader.taille_fichier / self.downloader.taille_bloc
				self.gauge.SetRange(self.nb_blocs_max)
				self.gauge.SetValue(self.downloader.nb_blocs)

				self.tailleFichierB = float(self.downloader.taille_fichier / 1048576.0)
				self.octetsLoadedB = float((self.downloader.nb_blocs * self.downloader.taille_bloc) / 1048576.0)
				self.octetsLoadedN = round(self.octetsLoadedB, 1)
				self.tailleFichierN = round(self.tailleFichierB, 1)

				self.estimation_txt = str(self.octetsLoadedN) + " "+_("of")+" " + str(self.tailleFichierN) + " "+_("MB downloaded")		
				self.txtEstimation.SetLabel(self.estimation_txt)
				if(self.downloader.finished == True):
					if(self.downloader.failed == True):
						self.release_but_fail(self)
						print("FAIL")
					else:
						self.release(self)
					self.downloading = False
				
					
					#self.downloader.Destroy()
			
		if(os.path.exists(self.file_id)):
			self.fichier = open(self.file_id,"r").readlines()
			if(self.downloading != True):
				try :
					if(self.gauge_i < 2):
						self.gauge_i += 1
					else:
						self.gauge.Pulse()
						self.gauge_i = 0
				except :
					pass

			if(self.fichier != self.oldfichier):
				if(len(self.fichier) > 0):
					if(self.fichier[0] == "MsgIn\n"):
						if(len(self.fichier) > 1):
							if(self.fichier[1] != "pulse\n" and self.fichier[1] != "set_text\n"):
								self.Destroy_all()

						if(len(self.fichier) > 1):
							if(self.fichier[1] == "pulse\n"):
								self.pulsebar.SetValue(int(self.fichier[2])/2)

							if(self.fichier[1] == "set_text\n"):
								self.texte_bis.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte_bis.SetPosition((20,135+self.space*16))
								self.texte_bis.Show()

							if(self.fichier[1] == "champ\n"):
								self.DrawHeader()
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()
								
								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()
								
								self.space=self.fichier[2].count("\\n")+1
								
								self.champ.SetPosition((20,85+self.space*16))
								self.champ.SetValue(self.fichier[4].replace("\n",""))
								self.champ.Show()
								
								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_champ)	
								wx.EVT_TEXT_ENTER(self, 400, self.release_champ)

							if(self.fichier[1] == "Login\n"):
								self.DrawHeader()
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()

								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()

								self.space=self.fichier[2].count("\\n")+1
								self.register_link = self.fichier[4]

								self.login.Show()
								self.loginbox.Show()
								self.password.Show()
								self.passbox.Show()
								self.register.Show()

								self.DrawCancel()
								self.DrawNext()
																
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_login)
									
							if(self.fichier[1] == "bigchamp\n"):
								self.DrawHeader()
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()

								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()

								self.space=self.fichier[2].count("\\n")+1

								self.bigchamp.SetPosition((20,85+self.space*16))
								self.bigchamp.SetValue(self.fichier[4].replace("\n",""))
								
								self.bigchamp.Show()

								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_bigchamp)
																
							if(self.fichier[1] == "browse\n"):
								self.DrawHeader()
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()
								
								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()
								
								self.space = self.fichier[2].count("\\n")+1
								
								self.browse.SetPosition(((330, 85+self.space*16)))
								self.browse.Show()
								
								self.champ.SetPosition((20,85+self.space*16))
								self.champ.SetValue(self.fichier[4].replace("\n",""))
								self.champ.Show()

								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_champ)	

							if(self.fichier[1] == "menu\n" or self.fichier[1] == "menu_num\n"):
								self.DrawHeader()
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()
								
								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()
								
								self.space = self.fichier[2].count("\\n")+1
								self.cut = self.fichier[5].replace("\n","")
								self.areaList = string.split(self.fichier[4].replace("\n",""),self.cut)
							
								self.space=self.fichier[2].count("\\n")+1
								
								self.Menu.SetPosition((20,85+self.space*16))
								
								self.Menu.Clear()
								self.Menu.InsertItems(self.areaList,0)
								self.Menu.Select(0)
								self.Menu.Show()
								
								self.DrawCancel()
								self.DrawNext()
								
								# Good event
								if(self.fichier[1] == "menu\n"):
									wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menu)	
									wx.EVT_LISTBOX_DCLICK(self, 103, self.release_menu)
								if(self.fichier[1] == "menu_num\n"):	
									wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menu_num)	
									wx.EVT_LISTBOX_DCLICK(self, 103, self.release_menu_num)

							if(self.fichier[1] == "menu_list\n"):
								self.DrawHeader()
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()

								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()

								self.space = self.fichier[2].count("\\n")+1
								self.cut = self.fichier[5].replace("\n","")
								self.areaList = string.split(self.fichier[4].replace("\n",""),self.cut)

								self.MenuList.SetPosition((20, 85+self.space*16))
								self.MenuList.Clear()
								self.MenuList.AppendItems(self.areaList)
								self.MenuList.Show()
								
								self.DrawCancel()
								self.DrawNext()
																
								if(self.fichier[6] != "\n"):
									self.MenuList.SetValue(self.fichier[6].replace("\n",""))
								else:
									self.MenuList.SetValue(self.areaList[0])
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menu_list)
											
											
							if(self.fichier[1] == "checkbox_list\n"):
								self.DrawHeader()
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()
								
								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()
								

								self.scrolled_panel.Show()
								self.space=self.fichier[2].count("\\n")+1
								
								self.scrolled_panel.SetPosition((20,85+self.space*16))
								
								self.cut = self.fichier[5].replace("\n","")
								self.areaList = string.split(self.fichier[4].replace("\n",""),self.cut)

								self.i = 0
								try:
									while(self.i <= len(self.item_check)):
										self.item_check[self.i].Destroy()
										self.i+=1
								except:
									pass
								self.item_check = []
								self.i = 0
								while(self.i < len(self.areaList)):							
									self.item_check.append(wx.CheckBox(self.scrolled_panel, -1, pos=(0,(self.i*25)),label=str(self.areaList[self.i])))
									self.i+=1

								self.scrolled_panel.SetVirtualSize((0,self.i*(25)))
								self.scrolled_panel.SetScrollRate(0,25)
								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_checkboxes)	

							if(self.fichier[1] == "attendre_signal\n" or self.fichier[1] == "pulsebar\n" or self.fichier[1] == "attendre_signal_b\n"):
								self.DrawHeader()
								self.timer_attendre = wx.Timer(self, 1)
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()
								
								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()
								
								self.space=self.fichier[2].count("\\n")+1
								self.gauge_space = self.space
								if(self.fichier[1] == "attendre_signal\n" or self.fichier[1] == "attendre_signal_b\n"):
									self.gauge.Show()
									self.gauge.SetPosition((70,95+self.space*16))
								else :
									self.pulsebar.Show()
									self.pulsebar.SetPosition((70,95+self.space*16))

								if(self.fichier[1] == "attendre_signal_b\n"):
									self.WaitButton.Show()
									self.WaitButton.SetLabel(self.fichier[4].replace("\n",""))
									self.WaitButton.SetPosition((135,135+self.space*16))
									self.Bind(wx.EVT_BUTTON, lambda event: self.RunCommand(event,self.fichier[5].replace("\n",""),self.fichier[6].replace("\n","")),self.WaitButton)
									
								self.DrawCancel()
								self.DrawNext()
								self.NextButton.Enable(False)

									
							if(self.fichier[1] == "download\n"):
								self.DrawHeader()
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()
								
								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()
								
								self.space=self.fichier[2].count("\\n")+1
								self.gauge.Show()
								self.gauge.SetPosition((70,95+self.space*16))
								
								self.txtEstimation.SetPosition((20,135+self.space*16))
								self.txtEstimation.Show()
								#self.titre.SetFont(self.fontText)
								self.DrawCancel()
								self.DrawNext()
								self.NextButton.Enable(False)	
								self.DownloadFile(self.fichier[4].replace("\n",""), self.fichier[5].replace("\n",""))
								#wx.EVT_BUTTON(self, 300, self.release)
						
							if(self.fichier[1] == "get_games\n"):
								self.DrawHeader()
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()

								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()
								

								self.add_games()
								self.MenuGames.Show()
								
								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menugame)	
								wx.EVT_TREE_ITEM_ACTIVATED(self, 111, self.release_menugame)	
							
							if(self.fichier[1] == "menu_icons\n"):
								self.DrawHeader()
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()

								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()

								self.add_menu_icons()
								self.MenuGames.Show()

								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menugame)	
								wx.EVT_TREE_ITEM_ACTIVATED(self, 111, self.release_menugame)
									
							if(self.fichier[1] == "get_prefixes\n"):
								self.DrawHeader()
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()

								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()
								

								self.add_games()
								self.MenuGames.Show()
								
								self.space=self.fichier[2].count("\\n")+1
								
								self.Menu.SetPosition((20,85+self.space*16))
								
								self.Menu.Clear()
								self.areaList = os.listdir(Variables.playonlinux_rep+"/wineprefix/")
								self.areaList.sort()
								
								for file in self.areaList:
									if (str(file[0]) == "."):
										self.areaList.remove(file)

								self.Menu.InsertItems(self.areaList,0)
								self.Menu.Select(0)
								self.Menu.Hide()
								
								self.DrawCancel()
								self.DrawNext()
								
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menuprefixes)	
								wx.EVT_TREE_ITEM_ACTIVATED(self, 111, self.release_menuprefixes)
								wx.EVT_LISTBOX_DCLICK(self, 103, self.release_menuprefixes)
									
								self.PCheckBox.Show()


							if(self.fichier[1] == "message\n"):
								self.DrawHeader()
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()
								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()
								#self.titre = wx.StaticText(self.header, -1, self.fichier[3],pos=(20,30), size=(340,356))
								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release)	

							if(self.fichier[1] == "licence\n"):
								self.DrawHeader()
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()
								
								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()
								
								#self.Mchamp.SetValue(open(self.fichier[4].replace("\n",""),"r").read())
								
								#
								
								self.texte_panel.SetLabel(open(self.fichier[4].replace("\n",""),"r").read())
								self.texte_panel.Wrap(400)
								self.texte_panel.Show()
								
								self.scrolled_panel.Show()
								self.scrolled_panel.SetVirtualSize(self.texte_panel.GetSize())
								self.scrolled_panel.SetScrollRate(0,25)
								
								self.MCheckBox.Show()
								
								self.DrawCancel()
								self.DrawNext()
								self.NextButton.Enable(False)
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release)	

								
							if(self.fichier[1] == "file\n"):
								self.DrawHeader()
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()

								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()

								self.texte_panel.SetLabel(open(self.fichier[4].replace("\n",""),"r").read())
								self.texte_panel.Wrap(400)
								self.texte_panel.Show()

								self.scrolled_panel.Show()
								self.scrolled_panel.SetVirtualSize(self.texte_panel.GetSize())
								self.scrolled_panel.SetScrollRate(0,25)

								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release)
							
							if(self.fichier[1] == "question\n"):
								self.DrawHeader()
								self.texte.SetLabel(self.fichier[2].replace("\\n","\n"))
								self.texte.Show()
								
								self.titre.SetLabel(self.fichier[3])
								self.titre.Show()
								
								#self.titre.SetFont(self.fontText)
								self.YesButton.Show()
								self.NoButton.Show()

							if(self.fichier[1] == "make_shortcut\n"):
								self.DrawHeader()
								self.texte.SetLabel(_("Create a shortcut :"))
								self.texte.Show()
								
								#self.titre_header = wx.StaticText(self.header, -1, _("PlayOnMac Wizard"),pos=(5,5), size=(340,356))
								#self.texte.SetFont(self.fontText)
								#self.titre_header.SetFont(self.fontTitre)
								self.titre_header.Show()
								#self.titre = wx.StaticText(self.header, -1, _("Do you want a shortcut for ")+self.fichier[2].replace("\n","")+" ?",pos=(20,30), size=(340,356))
								self.titre.SetLabel(_("Do you want a shortcut for ")+self.fichier[2].replace("\n","")+" ?")
								self.titre.Show()
								
								self.desktop = wx.CheckBox(self.panel, -1, _("On your desktop"),pos=(25,105))
								self.menu = wx.CheckBox(self.panel, -1, _("In your menu"),pos=(25,125))

								#self.titre.SetFont(self.fontText)
								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_icons)	
					
							if(self.fichier[1] == "free_presentation\n"):
								self.MainPanel.Show()
								self.titreP.SetLabel(self.fichier[2])
								self.titreP.Wrap(280)
								
								self.texteP.SetLabel(self.fichier[3].replace("\\n","\n").decode("utf8"))
								self.texteP.Wrap(360)
								self.texteP.Show()
								
								self.DrawCancel()
								self.DrawNext()

								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release)					
								self.DrawImage()

							if(self.fichier[1] == "exit\n"):
								#self.Destroy()
								self.CleanExit()

						self.oldfichier = self.fichier
Пример #26
0
    def __init__(self, parent, id, title, snapshot_object):
        # ... use the default Clip Properties Dialog size passed in from the config object.  (This does NOT get saved.)
        size = TransanaGlobal.configData.clipPropertiesSize
        # Define the Help Context
        HelpContext='Snapshot Properties'

        # Make the Keyword Edit List resizable by passing wx.RESIZE_BORDER style.  Signal that Propogation is included.
        Dialogs.GenForm.__init__(self, parent, id, title, size=size, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
                                 useSizers = True, HelpContext=HelpContext)
        # Define the minimum size for this dialog as the initial size
        minWidth = 750
        minHeight = 570
        # Remember the Parent Window
        self.parent = parent
        # Remember the original Snapshot Object passed in
        self.obj = snapshot_object

        # Create the form's main VERTICAL sizer
        mainSizer = wx.BoxSizer(wx.VERTICAL)

        # Create a HORIZONTAL sizer for the first row
        r1Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v1 = wx.BoxSizer(wx.VERTICAL)
        # Snapshot ID
        self.id_edit = self.new_edit_box(_("Snapshot ID"), v1, self.obj.id, maxLen=100)
        # Add the element to the sizer
        r1Sizer.Add(v1, 1, wx.EXPAND)

        # Add a horizontal spacer to the row sizer        
        r1Sizer.Add((10, 0))

        # Update the Snapshot's Collection ID based on the Snapshot's Collection Number
        self.obj._sync_snapshot()

        # Create a VERTICAL sizer for the next element
        v2 = wx.BoxSizer(wx.VERTICAL)
        # Collection ID
        collection_edit = self.new_edit_box(_("Collection ID"), v2, self.obj.GetNodeString(False))
        # Add the element to the sizer
        r1Sizer.Add(v2, 2, wx.EXPAND)
        collection_edit.Enable(False)
        
        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r1Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))

        # Create a HORIZONTAL sizer for the next row
        r2Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v3 = wx.BoxSizer(wx.VERTICAL)

        # Image Filename
        # If the image filename path is not empty, we should normalize the path specification
        if self.obj.image_filename == '':
            filePath = self.obj.image_filename
        else:
            filePath = os.path.normpath(self.obj.image_filename)

        self.fname_edit = self.new_edit_box(_("Image Filename"), v3, filePath)
        r2Sizer.Add(v3, 5, wx.EXPAND)

        r2Sizer.Add((10, 0))

        # Browse button layout
        btnBrowse = wx.Button(self.panel, wx.ID_FILE1, _("Browse"), wx.DefaultPosition)
        r2Sizer.Add(btnBrowse, 0, wx.EXPAND | wx.TOP, 20)
        wx.EVT_BUTTON(self, wx.ID_FILE1, self.OnBrowse)


        # Figure out if the Snapshot Button should be displayed
        if ((isinstance(self.parent.ControlObject.currentObj, Episode.Episode)) or \
            (isinstance(self.parent.ControlObject.currentObj, Clip.Clip))) and \
           (len(self.parent.ControlObject.VideoWindow.mediaPlayers) == 1):

            # Add a horizontal spacer
            r2Sizer.Add((10, 0))

            # Snapshot button layout
            # Create the Snapshot button
            btnSnapshot = wx.BitmapButton(self.panel, -1, TransanaImages.Snapshot.GetBitmap(), size=(48, 24))
            # Set the Help String
            btnSnapshot.SetToolTipString(_("Capture Snapshot for Coding"))
            r2Sizer.Add(btnSnapshot, 0, wx.EXPAND | wx.TOP, 20)
            # Bind the Snapshot button to its event handler
            btnSnapshot.Bind(wx.EVT_BUTTON, self.OnSnapshot)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r2Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))

        # Create a HORIZONTAL sizer for the next row
        r4Sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.seriesList = DBInterface.list_of_series()
        seriesRecs = ['']
        serDefault = 0
        for (seriesNum, seriesName) in self.seriesList:
            seriesRecs.append(seriesName)
            if self.obj.series_num == seriesNum:
                serDefault = len(seriesRecs) - 1

        # Create a VERTICAL sizer for the next element
        v4 = wx.BoxSizer(wx.VERTICAL)
        # Library ID
        self.series_cb = self.new_choice_box(_("Library ID"), v4, seriesRecs, default = serDefault)
        # Add the element to the sizer
        r4Sizer.Add(v4, 1, wx.EXPAND)
        self.series_cb.Bind(wx.EVT_CHOICE, self.OnSeriesChoice)

        # Add a horizontal spacer to the row sizer        
        r4Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v5 = wx.BoxSizer(wx.VERTICAL)
        # Episode ID
        self.episode_cb = self.new_choice_box(_("Episode ID"), v5, [''])
        # Add the element to the sizer
        r4Sizer.Add(v5, 1, wx.EXPAND)
        self.episode_cb.Bind(wx.EVT_CHOICE, self.OnEpisodeChoice)

        self.episodeList = []
        if self.obj.series_id != '':
            self.PopulateEpisodeChoiceBasedOnSeries(self.obj.series_id)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r4Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))
        
        # Create a HORIZONTAL sizer for the next row
        r5Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v6 = wx.BoxSizer(wx.VERTICAL)
        # Episode ID
        self.transcript_cb = self.new_choice_box(_("Transcript ID"), v6, [''])
        # Add the element to the sizer
        r5Sizer.Add(v6, 2, wx.EXPAND)
        self.transcript_cb.Bind(wx.EVT_CHOICE, self.OnTranscriptChoice)

        self.transcriptList = []
        if self.obj.episode_id != '':
            self.PopulateTranscriptChoiceBasedOnEpisode(self.obj.series_id, self.obj.episode_id)

        # Add a horizontal spacer to the row sizer        
        r5Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v7 = wx.BoxSizer(wx.VERTICAL)
        # Episode Time Code.  Convert to HH:MM:SS.mm
        self.episode_start_edit = self.new_edit_box(_("Episode Position"), v7, Misc.time_in_ms_to_str(self.obj.episode_start))
        # Add the element to the sizer
        r5Sizer.Add(v7, 1, wx.EXPAND)
        if self.episode_cb.GetStringSelection() == '':
            self.episode_start_edit.Enable(False)

        # Add a horizontal spacer to the row sizer        
        r5Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v8 = wx.BoxSizer(wx.VERTICAL)
        # Episode Duration.  Convert to HH:MM:SS.mm
        self.episode_duration_edit = self.new_edit_box(_("Duration"), v8, Misc.time_in_ms_to_str(self.obj.episode_duration))
        # Add the element to the sizer
        r5Sizer.Add(v8, 1, wx.EXPAND)
        if self.episode_cb.GetStringSelection() == '':
            self.episode_duration_edit.Enable(False)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r5Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))
        
        # Create a HORIZONTAL sizer for the next row
        r6Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v9 = wx.BoxSizer(wx.VERTICAL)
        # Comment
        comment_edit = self.new_edit_box(_("Comment"), v9, self.obj.comment, maxLen=255)
        # Add the element to the sizer
        r6Sizer.Add(v9, 1, wx.EXPAND)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r6Sizer, 0, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))
        
        # Create a HORIZONTAL sizer for the next row
        r7Sizer = wx.BoxSizer(wx.HORIZONTAL)

        # Create a VERTICAL sizer for the next element
        v10 = wx.BoxSizer(wx.VERTICAL)
        # Keyword Group [label]
        txt = wx.StaticText(self.panel, -1, _("Keyword Group"))
        v10.Add(txt, 0, wx.BOTTOM, 3)

        # Keyword Group [list box]

        # Create an empty Keyword Group List for now.  We'll populate it later (for layout reasons)
        self.kw_groups = []
        self.kw_group_lb = wx.ListBox(self.panel, -1, choices = self.kw_groups)
        v10.Add(self.kw_group_lb, 1, wx.EXPAND)
        
        # Add the element to the sizer
        r7Sizer.Add(v10, 1, wx.EXPAND)

        # Create an empty Keyword List for now.  We'll populate it later (for layout reasons)
        self.kw_list = []
        wx.EVT_LISTBOX(self, self.kw_group_lb.GetId(), self.OnGroupSelect)

        # Add a horizontal spacer
        r7Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v11 = wx.BoxSizer(wx.VERTICAL)
        # Keyword [label]
        txt = wx.StaticText(self.panel, -1, _("Keyword"))
        v11.Add(txt, 0, wx.BOTTOM, 3)

        # Keyword [list box]
        self.kw_lb = wx.ListBox(self.panel, -1, choices = self.kw_list, style=wx.LB_EXTENDED)
        v11.Add(self.kw_lb, 1, wx.EXPAND)

        wx.EVT_LISTBOX_DCLICK(self, self.kw_lb.GetId(), self.OnAddKW)

        # Add the element to the sizer
        r7Sizer.Add(v11, 1, wx.EXPAND)

        # Add a horizontal spacer
        r7Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v12 = wx.BoxSizer(wx.VERTICAL)
        # Keyword transfer buttons
        add_kw = wx.Button(self.panel, wx.ID_FILE2, ">>", wx.DefaultPosition)
        v12.Add(add_kw, 0, wx.EXPAND | wx.TOP, 20)
        wx.EVT_BUTTON(self, wx.ID_FILE2, self.OnAddKW)

        rm_kw = wx.Button(self.panel, wx.ID_FILE3, "<<", wx.DefaultPosition)
        v12.Add(rm_kw, 0, wx.EXPAND | wx.TOP, 10)
        wx.EVT_BUTTON(self, wx.ID_FILE3, self.OnRemoveKW)

        kwm = wx.BitmapButton(self.panel, wx.ID_FILE4, TransanaImages.KWManage.GetBitmap())
        v12.Add(kwm, 0, wx.EXPAND | wx.TOP, 10)
        # Add a spacer to increase the height of the Keywords section
        v12.Add((0, 60))
        kwm.SetToolTipString(_("Keyword Management"))
        wx.EVT_BUTTON(self, wx.ID_FILE4, self.OnKWManage)

        # Add the element to the sizer
        r7Sizer.Add(v12, 0)

        # Add a horizontal spacer
        r7Sizer.Add((10, 0))

        # Create a VERTICAL sizer for the next element
        v13 = wx.BoxSizer(wx.VERTICAL)

        # Whole Snapshot Keywords [label]
        txt = wx.StaticText(self.panel, -1, _("Whole Snapshot Keywords"))
        v13.Add(txt, 0, wx.BOTTOM, 3)

        # Clip Keywords [list box]
        # Create an empty ListBox.  We'll populate it later for layout reasons.
        self.ekw_lb = wx.ListBox(self.panel, -1, style=wx.LB_EXTENDED)
        v13.Add(self.ekw_lb, 1, wx.EXPAND)

        self.ekw_lb.Bind(wx.EVT_KEY_DOWN, self.OnKeywordKeyDown)

        # Add the element to the sizer
        r7Sizer.Add(v13, 2, wx.EXPAND)

        # Add the row sizer to the main vertical sizer
        mainSizer.Add(r7Sizer, 5, wx.EXPAND)

        # Add a vertical spacer to the main sizer        
        mainSizer.Add((0, 10))
        
        # Create a sizer for the buttons
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        # Add the buttons
        self.create_buttons(sizer=btnSizer)
        # Add the button sizer to the main sizer
        mainSizer.Add(btnSizer, 0, wx.EXPAND)

##        # Because of the way Clips are created (with Drag&Drop / Cut&Paste functions), we have to trap the missing
##        # ID error here.  Therefore, we need to override the EVT_BUTTON for the OK Button.
##        # Since we don't have an object for the OK Button, we use FindWindowById to find it based on its ID.
##        self.Bind(wx.EVT_BUTTON, self.OnOK, self.FindWindowById(wx.ID_OK))
##        # We also need to intercept the Cancel button.
##        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.FindWindowById(wx.ID_CANCEL))
##
##        self.Bind(wx.EVT_SIZE, self.OnSize)
##
        # Set the main sizer
        self.panel.SetSizer(mainSizer)
        # Tell the panel to auto-layout
        self.panel.SetAutoLayout(True)
        # Lay out the Panel
        self.panel.Layout()
        # Lay out the form
        self.Layout()
        # Resize the form to fit the contents
        self.Fit()

        # Get the new size of the form
        (width, height) = self.GetSizeTuple()
        # Reset the form's size to be at least the specified minimum width
        self.SetSize(wx.Size(max(minWidth, width), max(minHeight, height)))
        # Define the minimum size for this dialog as the current size
        self.SetSizeHints(max(minWidth, width), max(minHeight, height))
        # Center the form on screen
        TransanaGlobal.CenterOnPrimary(self)

        # We need to set some minimum sizes so the sizers will work right
        self.kw_group_lb.SetSizeHints(minW = 50, minH = 20)
        self.kw_lb.SetSizeHints(minW = 50, minH = 20)
        self.ekw_lb.SetSizeHints(minW = 50, minH = 20)

        # We populate the Keyword Groups, Keywords, and Clip Keywords lists AFTER we determine the Form Size.
        # Long Keywords in the list were making the form too big!

        self.kw_groups = DBInterface.list_of_keyword_groups()
        for keywordGroup in self.kw_groups:
            self.kw_group_lb.Append(keywordGroup)

        # Populate the Keywords ListBox
        # Load the parent Collection in order to determine the default Keyword Group
        tempCollection = Collection.Collection(self.obj.collection_num)
        # Select the Collection Default Keyword Group in the Keyword Group list
        if (tempCollection.keyword_group != '') and (self.kw_group_lb.FindString(tempCollection.keyword_group) != wx.NOT_FOUND):
            self.kw_group_lb.SetStringSelection(tempCollection.keyword_group)
        # If no Default Keyword Group is defined, select the first item in the list
        else:
            # but only if there IS a first item.
            if len(self.kw_groups) > 0:
                self.kw_group_lb.SetSelection(0)
        # If there's a selected keyword group ...
        if self.kw_group_lb.GetSelection() != wx.NOT_FOUND:
            # populate the Keywords list
            self.kw_list = \
                DBInterface.list_of_keywords_by_group(self.kw_group_lb.GetStringSelection())
        else:
            # If not, create a blank one
            self.kw_list = []
        for keyword in self.kw_list:
            self.kw_lb.Append(keyword)

        # Populate the Snapshot Keywords ListBox
        # If the snapshot object has keywords ... 
        for snapshotKeyword in self.obj.keyword_list:
            # ... add them to the keyword list
            self.ekw_lb.Append(snapshotKeyword.keywordPair)

        # Set initial focus to the Clip ID
        self.id_edit.SetFocus()
Пример #27
0
	def AutoReload(self, event):
		if(os.path.exists(self.file_id)):
			self.fichier = open(self.file_id,"r").readlines()
			try :
				if(self.gauge_i < 2):
					self.gauge_i += 1
				else:
					self.gauge.Pulse()
					self.gauge_i = 0
				
			except :
				pass

			if(self.fichier != self.oldfichier):
				if(len(self.fichier) > 0):
					if(self.fichier[0] == "MsgIn\n"):
						if(len(self.fichier) > 1):
							if(self.fichier[1] != "pulse\n" and self.fichier[1] != "set_text\n"):
								self.Destroy_all()

						if(len(self.fichier) > 1):
							if(self.fichier[1] == "pulse\n"):
								self.pulsebar.SetValue(int(self.fichier[2])/2)

							if(self.fichier[1] == "set_text\n"):
								try :
									self.texte_bis.Destroy()
								except :
									pass
								self.texte_bis = wx.StaticText(self.panel, -1, self.fichier[2].replace("\\n","\n"),pos=(20,80+self.gauge_space*13+18))
								self.texte_bis.SetFont(self.fontText)

							if(self.fichier[1] == "champ\n"):
								self.DrawHeader()
								self.texte = wx.StaticText(self.panel, -1, self.fichier[2].replace("\\n","\n"),pos=(20,80))
								self.texte.SetFont(self.fontText)
								self.titre_header = wx.StaticText(self.header, -1, _("PlayOnLinux Wizard"),pos=(5,5), size=(340,356))
								self.titre_header.SetFont(self.fontTitre)
								self.titre = wx.StaticText(self.header, -1, self.fichier[3],pos=(20,30), size=(340,356))
								space=self.fichier[2].count("\\n")+1
								self.champ = wx.TextCtrl(self.panel, -1, self.fichier[4].replace("\n",""),pos=(20,80+space*13),size=(300,25))
								self.titre.SetFont(self.fontText)
								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_champ)	
							
							if(self.fichier[1] == "browse\n"):
								self.DrawHeader()
								self.texte = wx.StaticText(self.panel, -1, self.fichier[2].replace("\\n","\n"),pos=(20,80))
								self.texte.SetFont(self.fontText)
								self.titre_header = wx.StaticText(self.header, -1, _("PlayOnLinux Wizard"),pos=(5,5), size=(340,356))
								self.titre_header.SetFont(self.fontTitre)
								self.titre = wx.StaticText(self.header, -1, self.fichier[3],pos=(20,30), size=(340,356))
								space=self.fichier[2].count("\\n")+1
								self.browse = wx.Button(self.panel, 103, _("Browse"), (330, 80+space*13), (80,25))
								self.champ = wx.TextCtrl(self.panel, -1, self.fichier[4].replace("\n",""),pos=(20,80+space*13),size=(300,25))
								self.titre.SetFont(self.fontText)
								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_champ)	
								wx.EVT_BUTTON(self, 103,  self.Parcourir)

							if(self.fichier[1] == "menu\n" or self.fichier[1] == "menu_num\n" or self.fichier[1] == "menu_list\n"):
								self.DrawHeader()
								self.texte = wx.StaticText(self.panel, -1, self.fichier[2].replace("\\n","\n"),pos=(20,80))
								self.texte.SetFont(self.fontText)
								self.titre_header = wx.StaticText(self.header, -1, _("PlayOnLinux Wizard"),pos=(5,5), size=(340,356))
								self.titre_header.SetFont(self.fontTitre)
								self.titre = wx.StaticText(self.header, -1, self.fichier[3],pos=(20,30), size=(340,356))
								space = self.fichier[2].count("\\n")+1
								cut = self.fichier[5].replace("\n","")
								self.areaList = string.split(self.fichier[4].replace("\n",""),cut)
								if(self.fichier[1] == "menu\n" or self.fichier[1] == "menu_num\n"):
									self.Menu = wx.ListBox(self.panel, 103, pos=(20,100),size=(460,230), choices=self.areaList)
									self.Menu.Select(0)
								else:
									self.Menu = wx.ComboBox(self.panel, 103, value=self.areaList[0], pos=(20, 80+space*13), choices=self.areaList, style=wx.CB_READONLY)
									if(self.fichier[6] != "\n"):
										self.Menu.SetValue(self.fichier[6].replace("\n",""))
				
								self.titre.SetFont(self.fontText)
								self.DrawCancel()
								self.DrawNext()
								if(self.fichier[1] == "menu\n"):
									wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menu)	
									wx.EVT_LISTBOX_DCLICK(self, 103, self.release_menu)
								if(self.fichier[1] == "menu_num\n"):	
									wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menu_num)	
									wx.EVT_LISTBOX_DCLICK(self, 103, self.release_menu_num)
								if(self.fichier[1] == "menu_list\n"):
									wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menu_list)	

							if(self.fichier[1] == "checkbox_list\n"):
								self.DrawHeader()
								self.texte = wx.StaticText(self.panel, -1, self.fichier[2].replace("\\n","\n"),pos=(20,80))
								self.texte.SetFont(self.fontText)
								self.titre_header = wx.StaticText(self.header, -1, _("PlayOnLinux Wizard"),pos=(5,5), size=(340,356))
								self.titre_header.SetFont(self.fontTitre)
								self.titre = wx.StaticText(self.header, -1, self.fichier[3],pos=(20,30), size=(340,356))
								self.titre.SetFont(self.fontText)
								self.scrolled_panel = wx.ScrolledWindow(self.panel, -1, pos=(20,100), size=(460,230), style=wx.RAISED_BORDER|wx.HSCROLL|wx.VSCROLL)
								self.scrolled_panel.SetBackgroundColour((255,255,255))								
								
								cut = self.fichier[5].replace("\n","")
								self.areaList = string.split(self.fichier[4].replace("\n",""),cut)

								self.i = 0
								self.item_check = []
								while(self.i < len(self.areaList)):
									self.item_check.append(wx.CheckBox(self.scrolled_panel, -1, pos=(0,(self.i*25)),label=str(self.areaList[self.i])))
									#self.item_name = wx.StaticText(self.scrolled_panel, -1, size=(200,20), pos=(30,(self.i*20)+5))
									self.i+=1

								self.scrolled_panel.SetVirtualSize((0,self.i*(25)))
								self.scrolled_panel.SetScrollRate(0,25)
								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_checkboxes)	

							if(self.fichier[1] == "attendre\n"):
								self.DrawHeader()
								self.timer_attendre = wx.Timer(self, 1)
								self.texte = wx.StaticText(self.panel, -1, self.fichier[2].replace("\\n","\n"),pos=(20,80))
								self.texte.SetFont(self.fontText)
								self.titre_header = wx.StaticText(self.header, -1, _("PlayOnLinux Wizard"),pos=(5,5), size=(340,356))
								self.titre_header.SetFont(self.fontTitre)
								self.titre = wx.StaticText(self.header, -1, self.fichier[3],pos=(20,30), size=(340,356))
								space=self.fichier[2].count("\\n")+1
								self.gauge = wx.Gauge(self.panel, -1, 50, pos=(20,80+space*13), size=(475, 17))
								self.titre.SetFont(self.fontText)
								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release)	
								self.p = Popen(self.fichier[4],shell=True,stdin=PIPE,stdout=PIPE,close_fds=True)
								self.Bind(wx.EVT_TIMER, self.DemanderPourcent, self.timer_attendre)
								self.timer.Stop()						
								self.timer_attendre.Start(50)

							if(self.fichier[1] == "attendre_signal\n" or self.fichier[1] == "pulsebar\n"):
								self.DrawHeader()
								self.timer_attendre = wx.Timer(self, 1)
								self.texte = wx.StaticText(self.panel, -1, self.fichier[2].replace("\\n","\n"),pos=(20,80))
								self.texte.SetFont(self.fontText)
								self.titre_header = wx.StaticText(self.header, -1, _("PlayOnLinux Wizard"),pos=(5,5), size=(340,356))
								self.titre_header.SetFont(self.fontTitre)
								self.titre = wx.StaticText(self.header, -1, self.fichier[3],pos=(20,30), size=(340,356))
								space=self.fichier[2].count("\\n")+1
								self.gauge_space = space
								if(self.fichier[1] == "attendre_signal\n"):
									self.gauge = wx.Gauge(self.panel, -1, 50, pos=(20,80+space*13), size=(475, 17))
								else :
									self.pulsebar = wx.Gauge(self.panel, -1, 50, pos=(20,80+space*13), size=(475, 17))
								self.titre.SetFont(self.fontText)
								self.DrawCancel()
								self.DrawNext()
								self.NextButton.Enable(False)

							if(self.fichier[1] == "download\n"):
								self.DrawHeader()
								self.texte = wx.StaticText(self.panel, -1, self.fichier[2].replace("\\n","\n"),pos=(20,80))
								self.texte.SetFont(self.fontText)
								self.titre_header = wx.StaticText(self.header, -1, _("PlayOnLinux Wizard"),pos=(5,5), size=(340,356))
								self.titre_header.SetFont(self.fontTitre)
								self.titre = wx.StaticText(self.header, -1, self.fichier[3],pos=(20,30), size=(340,356))
								space=self.fichier[2].count("\\n")+1
								self.gauge = wx.Gauge(self.panel, -1, 50, pos=(20,80+space*13), size=(475, 17))
								self.txtEstimation = wx.StaticText(self.panel, -1, "", pos=(20,98+space*13))
								self.titre.SetFont(self.fontText)
								self.DrawCancel()
								self.DrawNext()
								self.NextButton.Enable(False)	
								self.DownloadFile(self.fichier[4].replace("\n",""), self.fichier[5].replace("\n",""))
								#wx.EVT_BUTTON(self, 300, self.release)
						
							if(self.fichier[1] == "get_games\n"):
								self.images = wx.ImageList(22, 22)
								self.DrawHeader()
								self.texte = wx.StaticText(self.panel, -1, self.fichier[2].replace("\\n","\n"),pos=(20,80))
								self.texte.SetFont(self.fontText)
								self.titre_header = wx.StaticText(self.header, -1, _("PlayOnLinux Wizard"),pos=(5,5), size=(340,356))
								self.titre_header.SetFont(self.fontTitre)
								self.titre = wx.StaticText(self.header, -1, self.fichier[3],pos=(20,30), size=(340,356))
			   					self.Menu = wx.TreeCtrl(self.panel, 111, style=wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT|wx.RAISED_BORDER, pos=(20,100),size=(460,230))
			   					self.Menu.SetImageList(self.images)
			   					self.Menu.SetSpacing(0);
								self.add_games()
								self.titre.SetFont(self.fontText)
								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_menugame)	
								wx.EVT_TREE_ITEM_ACTIVATED(self, 111, self.release_menugame)	

							if(self.fichier[1] == "message\n" or self.fichier[1] == "message_image\n"):
								self.DrawHeader()
								if(self.fichier[1] == "message\n"):
									self.texte = wx.StaticText(self.panel, -1, self.fichier[2].replace("\\n","\n"),pos=(20,80))
								else :
									self.bitmap = wx.Bitmap(self.fichier[4].replace("\n",""))
									self.image = wx.StaticBitmap(self.panel, -1, self.bitmap, (20,80), wx.DefaultSize)
									self.texte = wx.StaticText(self.panel, -1, self.fichier[2].replace("\\n","\n"),pos=(self.bitmap.GetWidth()+40,80))
								self.titre_header = wx.StaticText(self.header, -1, _("PlayOnLinux Wizard"),pos=(5,5), size=(340,356))
								self.texte.SetFont(self.fontText)
								self.titre_header.SetFont(self.fontTitre)
								self.titre = wx.StaticText(self.header, -1, self.fichier[3],pos=(20,30), size=(340,356))
								self.titre.SetFont(self.fontText)
								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release)	

							if(self.fichier[1] == "licence\n"):
								self.DrawHeader()
								self.texte = wx.StaticText(self.panel, -1, self.fichier[2].replace("\\n","\n"),pos=(20,80))
								self.titre_header = wx.StaticText(self.header, -1, _("PlayOnLinux Wizard"),pos=(5,5), size=(340,356))
								self.champ = wx.TextCtrl(self.panel, 103, pos=(20,100),size=(460,220),style=wx.TE_MULTILINE | wx.CB_READONLY)
								self.texte.SetFont(self.fontText)
								self.titre_header.SetFont(self.fontTitre)
								self.titre = wx.StaticText(self.header, -1, self.fichier[3],pos=(20,30), size=(340,356))
								self.champ.SetValue(open(self.fichier[4].replace("\n",""),"r").read())
								self.titre.SetFont(self.fontText)
								self.Menu = wx.CheckBox(self.panel, 302, _("I Agree"), pos=(20,325))

								self.DrawCancel()
								self.DrawNext()
								self.NextButton.Enable(False)
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release)	
								wx.EVT_CHECKBOX(self, 302, self.agree)

							if(self.fichier[1] == "question\n"):
								self.DrawHeader()
								self.texte = wx.StaticText(self.panel, -1, self.fichier[2].replace("\\n","\n"),pos=(20,80))
								self.titre_header = wx.StaticText(self.header, -1, _("PlayOnLinux Wizard"),pos=(5,5), size=(340,356))
								self.texte.SetFont(self.fontText)
								self.titre_header.SetFont(self.fontTitre)
								self.titre = wx.StaticText(self.header, -1, self.fichier[3],pos=(20,30), size=(340,356))
								self.titre.SetFont(self.fontText)
								self.CancelButton = wx.Button(self.footer, wx.ID_NO, pos=(430,2),size=(85,37))
								self.NextButton = wx.Button(self.footer, wx.ID_YES, pos=(340,2), size=(85,37))
								wx.EVT_BUTTON(self, wx.ID_YES, self.release_yes)	
								wx.EVT_BUTTON(self, wx.ID_NO, self.release_no)	

							if(self.fichier[1] == "make_shortcut\n"):
								self.DrawHeader()
								self.texte = wx.StaticText(self.panel, -1, _("Create a shortcut: "),pos=(20,80))
								self.titre_header = wx.StaticText(self.header, -1, _("PlayOnLinux Wizard"),pos=(5,5), size=(340,356))
								self.texte.SetFont(self.fontText)
								self.titre_header.SetFont(self.fontTitre)
								self.titre = wx.StaticText(self.header, -1, _("Would you like a shortcut for: ")+self.fichier[2].replace("\n","")+" ?",pos=(20,30), size=(340,356))
								self.desktop = wx.CheckBox(self.panel, -1, _("On your desktop"),pos=(25,105))
								self.menu = wx.CheckBox(self.panel, -1, _("In your menu"),pos=(25,125))

								self.titre.SetFont(self.fontText)
								self.DrawCancel()
								self.DrawNext()
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release_icons)	

					
							if(self.fichier[1] == "free_presentation\n"):
								self.MainPanel = wx.Panel(self.panel, -1, pos=(150,0), size=(370,356))
								self.MainPanel.SetBackgroundColour((255,255,255))
								#self.titre = wx.StaticText(self.MainPanel, -1, "Welcome in PlayOnLinux installation program",pos=(5,5), size=(340,356))
								self.titre = wx.StaticText(self.MainPanel, -1, self.fichier[2],pos=(5,5), size=(340,356))
								self.titre.Wrap(280)
								self.texte = wx.StaticText(self.MainPanel, -1, self.fichier[3].replace("\\n","\n"),pos=(5,50))
								self.texte.Wrap(360)
								self.DrawCancel()
								self.DrawNext()
								self.titre.SetFont(self.fontTitre)	
								self.texte.SetFont(self.fontText)
								wx.EVT_BUTTON(self, wx.ID_FORWARD, self.release)					
								self.DrawImage()

							if(self.fichier[1] == "exit\n"):
								os.remove(self.file_id)
								sys.exit()

						self.oldfichier = self.fichier
Пример #28
0
    def __init__(self,
                 parent,
                 id,
                 pos=wxDefaultPosition,
                 size=wxDefaultSize,
                 style=wx.TAB_TRAVERSAL):

        wx.Panel.__init__(self, parent, id, pos, size, style)

        # if we are not inside gnumed we won't get a definite answer on
        # who and where we are. in this case try to get config source
        # from main config file (see gmCfg on how the name of this file
        # is determined
        # this is necessary to enable stand alone use of the drug browser
        currworkplace = gmPraxis.gmCurrentPraxisBranch().active_workplace
        if currworkplace is None:
            # assume we are outside gnumed
            self.dbName = _cfg.get('DrugReferenceBrowser', 'drugDBname')
        else:
            self.dbName, match = gmCfg.getDBParam(
                currworkplace, option="DrugReferenceBrowser.drugDBName")

        if self.dbName is None:
            if __name__ == '__main__':
                title = _('Starting drug data browser')
                msg = _(
                    'Cannot start the drug data browser.\n\n'
                    'There is no drug database specified in the configuration.'
                )
                gmGuiHelpers.gm_show_error(msg, title)
            _log.Log(gmLog.lErr,
                     "No drug database specified. Aborting drug browser.")
            # FIXME: we shouldn't directly call Close() on the parent
            #			parent.Close()
            raise gmExceptions.ConstructorError, "No drug database specified"

# initialize interface to drug database.
        # this will fail if backend or config files are not available
        try:
            self.mDrugView = gmDrugView.DrugView(self.dbName)
        except Exception:
            _log.LogException("Unhandled exception during DrugView API init.",
                              sys.exc_info(),
                              verbose=0)
            raise gmExceptions.ConstructorError, "Couldn't initialize DrugView API"
#			return None

        self.mode = MODE_PRODUCT
        self.previousMode = MODE_PRODUCT
        self.printer = wx.HtmlEasyPrinting(
        )  #printer object to print html page
        self.mId = None
        self.drugProductInfo = None
        self.__mListCtrlItems = {
        }  # array holding data on every row in the list

        #-------------------------------------------------------------
        # These things build the physical window that you see when
        # the program boots. They each refer to a subroutine that
        # is listed below by the same name eg def Menus_Create(self)
        #-------------------------------------------------------------
        self.GuiElements_Init()  # add main gui elements
        self.inDisplay_PI = 0  # first we display a drug list, not product info
        self.GetDrugIssue()  # ?

        #--------------------------------------------------------------
        # handler declarations for DrugDisplay
        # note handlers for menu in Menus_Create()
        #--------------------------------------------------------------
        wx.EVT_BUTTON(self, ID_BUTTON_PRINT, self.OnPrint)
        wx.EVT_BUTTON(self, ID_BUTTON_DISPLAY, self.OnDisplay)
        wx.EVT_BUTTON(self, ID_BUTTON_PRESCRIBE, self.OnPrescribe)
        wx.EVT_LISTBOX_DCLICK(self, ID_LISTBOX_JUMPTO, self.OnJumpToDblClick)
        wx.EVT_LISTBOX(self, ID_LISTBOX_JUMPTO, self.OnJumpToSelected)
        wx.EVT_LIST_ITEM_ACTIVATED(self, ID_LISTCTRL_DRUGCHOICE,
                                   self.OnDrugChoiceDblClick)
        wx.EVT_RADIOBUTTON(self, ID_RADIOBUTTON_BYINDICATION,
                           self.OnSearchByIndication)
        wx.EVT_RADIOBUTTON(self, ID_RADIOBUTTON_BYGENERIC,
                           self.OnSearchByGeneric)
        wx.EVT_RADIOBUTTON(self, ID_RADIOBUTTON_BYPRODUCT,
                           self.OnSearchByProduct)
        wx.EVT_RADIOBUTTON(self, ID_RADIOBUTTON_BYANY, self.OnSearchByAny)
        wx.EVT_TEXT(self, ID_COMBO_PRODUCT, self.OnProductKeyPressed)
        wx.EVT_COMBOBOX(self, ID_COMBO_PRODUCT, self.OnProductSelected)
        wx.EVT_BUTTON(self, wxID_OK, self.OnOk)
        wx.EVT_BUTTON(self, wxID_CANCEL, self.OnCancel)
        wx.EVT_BUTTON(self, ID_BUTTON_BOOKMARK, self.OnBookmark)
Пример #29
0
    def AutoReload(self, event):
        if (os.path.exists(self.file_id)):
            self.fichier = open(self.file_id, "r").readlines()
            try:
                if (self.gauge_i < 2):
                    self.gauge_i += 1
                else:
                    self.gauge.Pulse()
                    self.gauge_i = 0

            except:
                pass

            if (self.fichier != self.oldfichier):
                if (len(self.fichier) > 0):
                    if (self.fichier[0] == "MsgIn\n"):
                        if (len(self.fichier) > 1):
                            if (self.fichier[1] != "pulse\n"
                                    and self.fichier[1] != "set_text\n"):
                                self.Destroy_all()

                        if (len(self.fichier) > 1):
                            if (self.fichier[1] == "pulse\n"):
                                self.pulsebar.SetValue(
                                    int(self.fichier[2]) / 2)

                            if (self.fichier[1] == "set_text\n"):
                                self.texte_bis.SetLabel(
                                    self.fichier[2].replace("\\n", "\n"))
                                self.texte_bis.SetPosition(
                                    (20, 105 + self.space * 16))
                                self.texte_bis.Show()

                            if (self.fichier[1] == "champ\n"):
                                self.DrawHeader()
                                self.texte.SetLabel(self.fichier[2].replace(
                                    "\\n", "\n"))
                                self.texte.Show()

                                self.titre.SetLabel(self.fichier[3])
                                self.titre.Show()

                                self.space = self.fichier[2].count("\\n") + 1

                                self.champ.SetPosition(
                                    (20, 85 + self.space * 16))
                                self.champ.SetValue(self.fichier[4].replace(
                                    "\n", ""))
                                self.champ.Show()

                                self.DrawCancel()
                                self.DrawNext()
                                wx.EVT_BUTTON(self, wx.ID_FORWARD,
                                              self.release_champ)

                            if (self.fichier[1] == "browse\n"):
                                self.DrawHeader()
                                self.texte.SetLabel(self.fichier[2].replace(
                                    "\\n", "\n"))
                                self.texte.Show()

                                self.titre.SetLabel(self.fichier[3])
                                self.titre.Show()

                                self.space = self.fichier[2].count("\\n") + 1

                                self.browse.SetPosition(
                                    ((330, 85 + self.space * 16)))
                                self.browse.Show()

                                self.champ.SetPosition(
                                    (20, 85 + self.space * 16))
                                self.champ.SetValue(self.fichier[4].replace(
                                    "\n", ""))
                                self.champ.Show()

                                self.DrawCancel()
                                self.DrawNext()
                                wx.EVT_BUTTON(self, wx.ID_FORWARD,
                                              self.release_champ)

                            if (self.fichier[1] == "menu\n"
                                    or self.fichier[1] == "menu_num\n"):
                                self.DrawHeader()
                                self.texte.SetLabel(self.fichier[2].replace(
                                    "\\n", "\n"))
                                self.texte.Show()

                                self.titre.SetLabel(self.fichier[3])
                                self.titre.Show()

                                self.space = self.fichier[2].count("\\n") + 1
                                self.cut = self.fichier[5].replace("\n", "")
                                self.areaList = string.split(
                                    self.fichier[4].replace("\n", ""),
                                    self.cut)

                                self.Menu.Clear()
                                self.Menu.InsertItems(self.areaList, 0)
                                self.Menu.Select(0)
                                self.Menu.Show()

                                self.DrawCancel()
                                self.DrawNext()

                                # Good event
                                if (self.fichier[1] == "menu\n"):
                                    wx.EVT_BUTTON(self, wx.ID_FORWARD,
                                                  self.release_menu)
                                    wx.EVT_LISTBOX_DCLICK(
                                        self, 103, self.release_menu)
                                if (self.fichier[1] == "menu_num\n"):
                                    wx.EVT_BUTTON(self, wx.ID_FORWARD,
                                                  self.release_menu_num)
                                    wx.EVT_LISTBOX_DCLICK(
                                        self, 103, self.release_menu_num)

                            if (self.fichier[1] == "menu_list\n"):
                                self.DrawHeader()
                                self.texte.SetLabel(self.fichier[2].replace(
                                    "\\n", "\n"))
                                self.texte.Show()

                                self.titre.SetLabel(self.fichier[3])
                                self.titre.Show()

                                self.space = self.fichier[2].count("\\n") + 1
                                self.cut = self.fichier[5].replace("\n", "")
                                self.areaList = string.split(
                                    self.fichier[4].replace("\n", ""),
                                    self.cut)

                                self.MenuList.SetPosition(
                                    (20, 85 + self.space * 16))
                                self.MenuList.Clear()
                                self.MenuList.AppendItems(self.areaList)
                                self.MenuList.Show()

                                self.DrawCancel()
                                self.DrawNext()

                                if (self.fichier[6] != "\n"):
                                    self.MenuList.SetValue(
                                        self.fichier[6].replace("\n", ""))
                                else:
                                    self.MenuList.SetValue(self.areaList[0])
                                wx.EVT_BUTTON(self, wx.ID_FORWARD,
                                              self.release_menu_list)

                            if (self.fichier[1] == "checkbox_list\n"):
                                self.DrawHeader()
                                self.texte.SetLabel(self.fichier[2].replace(
                                    "\\n", "\n"))
                                self.texte.Show()

                                self.titre.SetLabel(self.fichier[3])
                                self.titre.Show()

                                self.scrolled_panel.Show()

                                self.cut = self.fichier[5].replace("\n", "")
                                self.areaList = string.split(
                                    self.fichier[4].replace("\n", ""),
                                    self.cut)

                                self.i = 0
                                self.item_check = []
                                while (self.i < len(self.areaList)):
                                    self.item_check.append(
                                        wx.CheckBox(
                                            self.scrolled_panel,
                                            -1,
                                            pos=(0, (self.i * 25)),
                                            label=str(self.areaList[self.i])))
                                    self.i += 1

                                self.scrolled_panel.SetVirtualSize(
                                    (0, self.i * (25)))
                                self.scrolled_panel.SetScrollRate(0, 25)
                                self.DrawCancel()
                                self.DrawNext()
                                wx.EVT_BUTTON(self, wx.ID_FORWARD,
                                              self.release_checkboxes)

                            if (self.fichier[1] == "attendre_signal\n"
                                    or self.fichier[1] == "pulsebar\n"):
                                self.DrawHeader()
                                self.timer_attendre = wx.Timer(self, 1)
                                self.texte.SetLabel(self.fichier[2].replace(
                                    "\\n", "\n"))
                                self.texte.Show()

                                self.titre.SetLabel(self.fichier[3])
                                self.titre.Show()

                                self.space = self.fichier[2].count("\\n") + 1
                                self.gauge_space = self.space
                                if (self.fichier[1] == "attendre_signal\n"):
                                    self.gauge.Show()
                                    self.gauge.SetPosition(
                                        (20, 85 + self.space * 16))
                                else:
                                    self.pulsebar.Show()
                                    self.pulsebar.SetPosition(
                                        (20, 85 + self.space * 16))

                                self.DrawCancel()
                                self.DrawNext()
                                self.NextButton.Enable(False)

                            if (self.fichier[1] == "download\n"):
                                self.DrawHeader()
                                self.texte.SetLabel(self.fichier[2].replace(
                                    "\\n", "\n"))
                                self.texte.Show()

                                self.titre.SetLabel(self.fichier[3])
                                self.titre.Show()

                                self.space = self.fichier[2].count("\\n") + 1
                                self.gauge.Show()
                                self.gauge.SetPosition(
                                    (20, 85 + self.space * 16))

                                self.txtEstimation.SetPosition(
                                    (20, 105 + self.space * 16))
                                self.txtEstimation.Show()
                                #self.titre.SetFont(self.fontText)
                                self.DrawCancel()
                                self.DrawNext()
                                self.NextButton.Enable(False)
                                self.DownloadFile(
                                    self.fichier[4].replace("\n", ""),
                                    self.fichier[5].replace("\n", ""))
                                #wx.EVT_BUTTON(self, 300, self.release)

                            if (self.fichier[1] == "get_games\n"):
                                self.DrawHeader()
                                self.texte.SetLabel(self.fichier[2].replace(
                                    "\\n", "\n"))
                                self.texte.Show()

                                self.titre.SetLabel(self.fichier[3])
                                self.titre.Show()

                                self.add_games()
                                self.MenuGames.Show()

                                self.DrawCancel()
                                self.DrawNext()
                                wx.EVT_BUTTON(self, wx.ID_FORWARD,
                                              self.release_menugame)
                                wx.EVT_TREE_ITEM_ACTIVATED(
                                    self, 111, self.release_menugame)

                            if (self.fichier[1] == "message\n"):
                                self.DrawHeader()
                                self.texte.SetLabel(self.fichier[2].replace(
                                    "\\n", "\n"))
                                self.texte.Show()
                                self.titre.SetLabel(self.fichier[3])
                                self.titre.Show()
                                #self.titre = wx.StaticText(self.header, -1, self.fichier[3],pos=(20,30), size=(340,356))
                                self.DrawCancel()
                                self.DrawNext()
                                wx.EVT_BUTTON(self, wx.ID_FORWARD,
                                              self.release)

                            if (self.fichier[1] == "licence\n"):
                                self.DrawHeader()
                                self.texte.SetLabel(self.fichier[2].replace(
                                    "\\n", "\n"))
                                self.texte.Show()

                                self.titre.SetLabel(self.fichier[3])
                                self.titre.Show()

                                #self.Mchamp.SetValue(open(self.fichier[4].replace("\n",""),"r").read())

                                #

                                self.texte_panel.SetLabel(
                                    open(self.fichier[4].replace("\n", ""),
                                         "r").read())
                                self.texte_panel.Wrap(400)
                                self.texte_panel.Show()

                                self.scrolled_panel.Show()
                                self.scrolled_panel.SetVirtualSize(
                                    self.texte_panel.GetSize())
                                self.scrolled_panel.SetScrollRate(0, 25)

                                self.MCheckBox.Show()

                                self.DrawCancel()
                                self.DrawNext()
                                self.NextButton.Enable(False)
                                wx.EVT_BUTTON(self, wx.ID_FORWARD,
                                              self.release)

                            if (self.fichier[1] == "question\n"):
                                self.DrawHeader()
                                self.texte.SetLabel(self.fichier[2].replace(
                                    "\\n", "\n"))
                                self.texte.Show()

                                self.titre.SetLabel(self.fichier[3])
                                self.titre.Show()

                                #self.titre.SetFont(self.fontText)
                                self.YesButton.Show()
                                self.NoButton.Show()

                            if (self.fichier[1] == "make_shortcut\n"):
                                self.DrawHeader()
                                self.texte.SetLabel(_("Create a shortcut :"))
                                self.texte.Show()

                                #self.titre_header = wx.StaticText(self.header, -1, _("PlayOnMac Wizard"),pos=(5,5), size=(340,356))
                                #self.texte.SetFont(self.fontText)
                                #self.titre_header.SetFont(self.fontTitre)
                                self.titre_header.Show()
                                #self.titre = wx.StaticText(self.header, -1, _("Do you want a shortcut for ")+self.fichier[2].replace("\n","")+" ?",pos=(20,30), size=(340,356))
                                self.titre.SetLabel(
                                    _("Do you want a shortcut for ") +
                                    self.fichier[2].replace("\n", "") + " ?")
                                self.titre.Show()

                                self.desktop.show()
                                self.menu.show()

                                #self.titre.SetFont(self.fontText)
                                self.DrawCancel()
                                self.DrawNext()
                                wx.EVT_BUTTON(self, wx.ID_FORWARD,
                                              self.release_icons)

                            if (self.fichier[1] == "free_presentation\n"):
                                self.MainPanel.Show()
                                self.titreP.SetLabel(self.fichier[2])
                                self.titreP.Wrap(280)
                                self.texteP.SetLabel(self.fichier[3].replace(
                                    "\\n", "\n").decode("utf8"))
                                self.texteP.Wrap(360)
                                self.texteP.Show()

                                self.DrawCancel()
                                self.DrawNext()

                                wx.EVT_BUTTON(self, wx.ID_FORWARD,
                                              self.release)
                                self.DrawImage()

                            if (self.fichier[1] == "exit\n"):
                                os.remove(self.file_id)
                                self.Close()

                        self.oldfichier = self.fichier
Пример #30
0
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Dialog.__init__(self, id=wxID_ADDFUNCTION, name='AddFunction',
              parent=prnt, pos=wx.Point(209, 210), size=wx.Size(533, 333),
              style=wx.DEFAULT_DIALOG_STYLE, title='Add Function')
        self._init_utils()
        self.SetClientSize(wx.Size(533, 333))

        self.panel1 = wx.Panel(id=wxID_ADDFUNCTIONPANEL1, name='panel1',
              parent=self, pos=wx.Point(0, 0), size=wx.Size(533, 333),
              style=wx.TAB_TRAVERSAL)
        self.panel1.SetAutoLayout(True)

        self.functionListBox = wx.ListBox(choices=[],
              id=wxID_ADDFUNCTIONFUNCTIONLISTBOX, name='functionListBox',
              parent=self.panel1, pos=wx.Point(8, 32), size=wx.Size(184, 224),
              style=0, validator=wx.DefaultValidator)
        wx.EVT_LISTBOX(self.functionListBox, wxID_ADDFUNCTIONFUNCTIONLISTBOX,
              self.OnListbox)
        wx.EVT_LISTBOX_DCLICK(self.functionListBox,
              wxID_ADDFUNCTIONFUNCTIONLISTBOX, self.OnOkButton)

        self.staticText1 = wx.StaticText(id=wxID_ADDFUNCTIONSTATICTEXT1,
              label='Standard Functions', name='staticText1',
              parent=self.panel1, pos=wx.Point(8, 8), size=wx.Size(109, 16),
              style=0)

        self.defaultTextCtrl = wx.TextCtrl(id=wxID_ADDFUNCTIONDEFAULTTEXTCTRL,
              name='defaultTextCtrl', parent=self.panel1, pos=wx.Point(208, 152),
              size=wx.Size(312, 128), style=wx.TE_READONLY | wx.TE_MULTILINE,
              value='')

        self.okButton = wx.Button(id=wxID_ADDFUNCTIONOKBUTTON, label='OK',
              name='okButton', parent=self.panel1, pos=wx.Point(216, 296),
              size=wx.Size(80, 22), style=0)
        wx.EVT_BUTTON(self.okButton, wxID_ADDFUNCTIONOKBUTTON, self.OnOkButton)

        self.cancelButton = wx.Button(id=wxID_ADDFUNCTIONCANCELBUTTON,
              label='Cancel', name='cancelButton', parent=self.panel1,
              pos=wx.Point(328, 296), size=wx.Size(80, 22), style=0)
        wx.EVT_BUTTON(self.cancelButton, wxID_ADDFUNCTIONCANCELBUTTON,
              self.OnCancelButton)

        self.staticText2 = wx.StaticText(id=wxID_ADDFUNCTIONSTATICTEXT2,
              label='Help', name='staticText2', parent=self.panel1,
              pos=wx.Point(208, 8), size=wx.Size(26, 16), style=0)

        self.staticText3 = wx.StaticText(id=wxID_ADDFUNCTIONSTATICTEXT3,
              label='Default Contents', name='staticText3', parent=self.panel1,
              pos=wx.Point(208, 130), size=wx.Size(92, 16), style=0)

        self.helpTextCtrl = wx.TextCtrl(id=wxID_ADDFUNCTIONHELPTEXTCTRL,
              name='helpTextCtrl', parent=self.panel1, pos=wx.Point(208, 32),
              size=wx.Size(312, 80), style=wx.TE_READONLY | wx.TE_MULTILINE,
              value='')

        self.staticText4 = wx.StaticText(id=wxID_ADDFUNCTIONSTATICTEXT4,
              label='New, Empty Function', name='staticText4',
              parent=self.panel1, pos=wx.Point(8, 264), size=wx.Size(120, 16),
              style=0)

        self.newTextCtrl = wx.TextCtrl(id=wxID_ADDFUNCTIONNEWTEXTCTRL,
              name='newTextCtrl', parent=self.panel1, pos=wx.Point(8, 288),
              size=wx.Size(184, 32), style=0, value='')
        wx.EVT_TEXT(self.newTextCtrl, wxID_ADDFUNCTIONNEWTEXTCTRL, self.OnText)