1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461
|
# Copyright 2004,2005 Pierre Martineau <pmartino@users.sourceforge.net>
# This file is part of Bibus, a bibliographic database that can
# work together with OpenOffice.org to generate bibliographic indexes.
#
# Bibus is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Bibus is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Bibus; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# generated by wxGlade 0.2 on Mon Apr 28 20:53:43 2003
# then edited by hand
# do not edit again with wxGlade !!
import wx
import BIB, urlparse, os, ShortcutEd
import RefEditor_Files
from RefEditor_Files import Panel_Files
from moveFile import MoveFile
#class RefEditor(wx.Dialog):
class RefEditor(wx.Frame):
def __init__(self, ref, db, selectedkey, editable, *args, **kwds): # ref=reference to edit or () if new
kwds["style"] = wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL
wx.Frame.__init__(self, *args, **kwds)
self.db = db # database
self.bibframe = args[0]
self.selectedkey = selectedkey
self.selectedText = None # last select TextCtrl. Where to paste data.
self.key,user,id = self.bibframe.keytree.GetPyData(selectedkey) # category where a new ref must be added
self.editable = editable # True if the ref is editable
if not ref:
self.ref_id = [None,u'']
else:
self.ref_id = list(ref[0:2]) # Id, Identifier of the record
self.__set_menu()
self.notebook_1 = wx.Notebook(self, -1, style = wx.TAB_TRAVERSAL)
self.__set_control(ref)
self.__set_control2()
self.__do_layout(BIB.REF_Ed_X, BIB.REF_Ed_Y, BIB.REF_Ed_WIDTH)
self.__set_event()
self.__set_properties(ref)
if not self.editable: self.setReadOnly()
#self.CenterOnParent()
RefEditor_Files.identifier = self.value['Identifier'].GetValue()
# ------------------------ menu ------------------------------------------------
def __set_menu(self):
self.menubar = wx.MenuBar()
self.SetMenuBar(self.menubar)
# No shortcuts
if not BIB.SHORTCUTS:
tmp_menu = wx.Menu()
self.menubar.Append(tmp_menu, _("You must first edit Pref/Shortcuts to use this menu"))
return
# shortcuts
self.menutopitem={} # we keep the index of the name of the topLabel for each Capture/Edit menu
index = 0
for shortname in BIB.SHORTCUTS:
if not BIB.SHORT.has_key( shortname ): # not read already
BIB.CONFIG.readShortcut( shortname )
tmp_menu = wx.Menu()
# we first insert a 'Capture'/'Edit' menu
tmp_menu = wx.Menu()
#
tmp_menuId = wx.NewId()
tmp_menu.Append(tmp_menuId, _('Capture selection'))
wx.EVT_MENU(self,tmp_menuId,self.capture)
self.menutopitem[tmp_menuId] = index
#
tmp_menuId = wx.NewId()
tmp_menu.Append(tmp_menuId, _('Edit shortcuts ...'))
self.menutopitem[tmp_menuId] = index
wx.EVT_MENU(self,tmp_menuId,self.editSortcuts)
#
tmp_menu.AppendSeparator()
# now the shortcuts
for shortcut in BIB.SHORT[ shortname ]:
tmp_menuId = wx.NewId()
tmp_menu.Append(tmp_menuId, shortcut)
wx.EVT_MENU(self,tmp_menuId,self.menu)
self.menubar.Append(tmp_menu, shortname )
index = index + 1
def menu(self,evt):
try:
#self.FindFocus().WriteText(self.menubar.FindItemById( evt.GetId() ).GetLabel()) # FindFocus() does not work in wx.2.4
self.selectedText.WriteText(self.menubar.FindItemById( evt.GetId() ).GetLabel())
except AttributeError:
return
def capture(self,evt):
try:
index = self.menutopitem[ evt.GetId() ]
#capturedstr = self.FindFocus().GetStringSelection() # FindFocus() does not work in wx.2.4
capturedstr = self.selectedText.GetStringSelection()
if capturedstr and capturedstr not in BIB.SHORT[ BIB.SHORTCUTS[index] ]: # capture only if not already there and not ''
BIB.SHORT[ BIB.SHORTCUTS[index] ].append(capturedstr)
# add the string to the end of menu
tmp_menuId = wx.NewId()
self.menubar.GetMenu(index).Append(tmp_menuId, capturedstr)
wx.EVT_MENU(self,tmp_menuId,self.menu)
except AttributeError:
return
def editSortcuts(self,evt):
index = self.menutopitem[ evt.GetId() ]
short = BIB.SHORT[ BIB.SHORTCUTS[index] ] #[:] # we make a copy
shEd = ShortcutEd.ShortcutEd(BIB.SHORTCUTS[index],short,self.db,self,-1,'')
if shEd.ShowModal() == wx.ID_OK:
# clear self.menutopitem for index
for id,ind in self.menutopitem.items():
if ind == index: del self.menutopitem[id]
# we update the menu
tmp_menu = wx.Menu()
# we first insert a 'Capture'/'Edit' menu
tmp_menu = wx.Menu()
#
tmp_menuId = wx.NewId()
tmp_menu.Append(tmp_menuId, _('Capture selection'))
self.menutopitem[tmp_menuId] = index
wx.EVT_MENU(self,tmp_menuId,self.capture)
#
tmp_menuId = wx.NewId()
tmp_menu.Append(tmp_menuId, _('Edit shortcuts ...'))
self.menutopitem[tmp_menuId] = index
wx.EVT_MENU(self,tmp_menuId,self.editSortcuts)
#
tmp_menu.AppendSeparator()
# now the shortcuts
for shortcut in BIB.SHORT[ BIB.SHORTCUTS[index] ]:
tmp_menuId = wx.NewId()
tmp_menu.Append(tmp_menuId, shortcut)
wx.EVT_MENU(self,tmp_menuId,self.menu)
# now we insert it at the place of the old one
oldmenu = self.menubar.GetMenu(index) # previous menu
self.menubar.Replace(index,tmp_menu,BIB.SHORTCUTS[index] )
oldmenu.Destroy() # destroy the old menu. Not needed for wx.2.4 ?
shEd.Destroy()
# ----------------------------- End menu ---------------------------------------
def setReadOnly(self):
"""disable panels because the ref is not editable"""
for key in self.value:
try:
self.value[key].SetEditable(False) # TextCtrl not editable
except AttributeError:
self.value[key].Disable()
self.label['Identifier'].Disable()
self.button_OK.Disable() # disable OK button button we cannot save a modification
self.button_Cancel.SetDefault() # set Cancel to Default
def __set_control(self,ref):
self.notebook_1_pane_4 = Panel_Files(self.notebook_1, style = wx.TAB_TRAVERSAL)
if self.ref_id[0]:
self.notebook_1_pane_4.setFiles( (ref[BIB.BIBLIOGRAPHIC_FIELDS['URL']],) + self.db.getFiles(self.ref_id[0]) )
#self.notebook_1_pane_3 = wx.Panel(self.notebook_1, -1)
self.notebook_1_pane_3 = wx.ScrolledWindow(self.notebook_1, style = wx.TAB_TRAVERSAL)
self.notebook_1_pane_3.SetScrollRate(10,10)
#self.notebook_1_pane_2 = wx.Panel(self.notebook_1, -1)
self.notebook_1_pane_2 = wx.ScrolledWindow(self.notebook_1, style = wx.TAB_TRAVERSAL)
self.notebook_1_pane_2.SetScrollRate(10,10)
#self.notebook_1_pane_1 = wx.Panel(self.notebook_1, -1)
self.notebook_1_pane_1 = wx.ScrolledWindow(self.notebook_1, style = wx.TAB_TRAVERSAL)
self.notebook_1_pane_1.SetScrollRate(10,10)
try:
self.bib_type = int(ref[BIB.BIBLIOGRAPHIC_FIELDS['BibliographicType']])
except IndexError:
self.bib_type = 0
self.label = {}
self.value = {}
# pane_1 = required fields
self.label['BibliographicType'] = wx.StaticText(self.notebook_1_pane_1, -1, BIB.NAME_FIELD["BibliographicType"])
self.value['BibliographicType'] = wx.Choice(self.notebook_1_pane_1, -1, choices=[BIB.NAME_TYPE[typ] for typ in BIB.BIB_TYPE])
self.label['Identifier'] = wx.CheckBox(self.notebook_1_pane_1,-1,_("Edit Identifier")) # if checked => editable Identifier
self.value['Identifier'] = wx.TextCtrl(self.notebook_1_pane_1, -1,style=BIB.EDIT_STYLE['Identifier'])
#self.value['Identifier'].SetBackgroundColour(wx.LIGHT_GREY)
#
for item in BIB.EDIT[BIB.BIB_TYPE[self.bib_type]][0] + ('Abstract',):
self.label[item] = wx.StaticText(self.notebook_1_pane_1, -1, BIB.NAME_FIELD[item])
self.value[item] = wx.TextCtrl(self.notebook_1_pane_1, -1,style=BIB.EDIT_STYLE[item])
# pane_2 = supplementary fields
for item in BIB.EDIT[BIB.BIB_TYPE[self.bib_type]][1]:
self.label[item] = wx.StaticText(self.notebook_1_pane_2, -1, BIB.NAME_FIELD[item])
self.value[item] = wx.TextCtrl(self.notebook_1_pane_2, -1,style=BIB.EDIT_STYLE[item])
# pane_3 = other fields
for item in BIB.BIB_FIELDS:
if item not in BIB.EDIT[BIB.BIB_TYPE[self.bib_type]][0]+BIB.EDIT[BIB.BIB_TYPE[self.bib_type]][1]+('Id','Identifier','BibliographicType','Abstract'):
self.label[item] = wx.StaticText(self.notebook_1_pane_3, -1, BIB.NAME_FIELD[item])
self.value[item] = wx.TextCtrl(self.notebook_1_pane_3, -1, style=BIB.EDIT_STYLE[item])
# replace label 'URL' with a button
self.label['URL'].Destroy()
if 'URL' in BIB.EDIT[BIB.BIB_TYPE[self.bib_type]][0]:
tmpnb = self.notebook_1_pane_1
elif 'URL' in BIB.EDIT[BIB.BIB_TYPE[self.bib_type]][1]:
tmpnb = self.notebook_1_pane_2
else:
tmpnb = self.notebook_1_pane_3
self.label['URL'] = wx.Button(tmpnb,-1,_('URL/File...'),style=wx.BU_LEFT)
# set event
for item in ('Identifier',) + BIB.BIB_FIELDS[3:-1]:
wx.EVT_SET_FOCUS(self.value[item],self.onFocus) # we save the current focus. Needed under w2.4 because FindFocus() does not work
#
def onFocus(self,evt):
self.selectedText = evt.GetEventObject()
evt.Skip()
def __set_control2(self):
self.button_Cancel = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
self.button_OK = wx.Button(self, wx.ID_OK, _("OK"))
def __set_event(self):
wx.EVT_BUTTON(self,wx.ID_OK,self.__OnOK)
wx.EVT_BUTTON(self,wx.ID_CANCEL,self.OnCloseWindow)
wx.EVT_CLOSE(self, self.OnCloseWindow)
wx.EVT_CHOICE(self,self.value['BibliographicType'].GetId(),self.onBibTypeChoice)
wx.EVT_CHECKBOX(self,self.label['Identifier'].GetId(),lambda evt: self.value['Identifier'].Enable(evt.IsChecked()) )
wx.EVT_BUTTON(self,self.label['URL'].GetId(),self.getURL)
self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.onPageChanging, self.notebook_1)
def onPageChanging(self,event):
if event.GetOldSelection() == 3: # We get the first URL from the tab "Fulltext" and set the URL field
self.value['URL'].SetValue( self.notebook_1_pane_4.getFiles()[0] )
else: # We select the Tab "Fulltext" and set the First URL in it
self.notebook_1_pane_4.setFirstURL( self.value['URL'].GetValue() )
def onBibTypeChoice(self,event):
ref = self.ref_id[0:1] # we make a copy to avoid modification
ref.append( self.value['Identifier'].GetValue())
ref.append( BIB.BIBLIOGRAPHIC_TYPE[BIB.TYPE_NAME[event.GetString()]] )
for item in BIB.BIB_FIELDS[3:]:
ref.append(self.value[item].GetValue())
editable = self.label['Identifier'].GetValue() # we save the state of the identifier: editable or not ?
self.__clear_control()
self.__set_control(ref)
self.__do_layout(self.GetPositionTuple()[0],self.GetPositionTuple()[1],self.GetSize().GetWidth())
self.__set_fields_values(ref)
# we restore the identifier state
self.label['Identifier'].SetValue(editable)
if editable: self.value['Identifier'].Enable(True)
else: self.value['Identifier'].Enable(False)
#
self.__set_event()
def __clear_control(self):
self.notebook_1.DeleteAllPages()
def getURL(self,event):
"""Select a file containing the reference"""
filename = wx.FileSelector(_("Please select the file"),BIB.FILES,wildcard=BIB.WILDCARD, parent=self )
if filename:
if BIB.FILES:
if not filename.startswith(BIB.FILES) and not filename.startswith("$FILES"):
# We propose to move/rename the doc to the default location
dlg = MoveFile(self,-1)
try:
dlg.setValues(self.value['Identifier'].GetValue(),filename,BIB.MOVEAUTO)
if not BIB.MOVEAUTO: answer = dlg.ShowModal()
if BIB.MOVEAUTO or answer == wx.ID_YES:
filename = dlg.rename()
#self.value['URL'].SetValue( filename )
finally:
dlg.Destroy()
if filename.startswith(BIB.FILES): # We replace the default directory with $FILES
filename = filename.replace(BIB.FILES,'$FILES',1)
self.value['URL'].SetValue( filename )
def OnCloseWindow(self,event):
#Saving position and width
BIB.REF_Ed_WIDTH = self.GetSizeTuple()[0] # saving width
BIB.REF_Ed_X, BIB.REF_Ed_Y = self.GetPositionTuple() # and position
self.Destroy()
def __checkAuthors(self,authors):
"""Check consistency of author list"""
for author in authors.split('\n'):
if not author.strip(): continue # empty line
if author.count(',') != 1:
ret = wx.MessageBox(\
_("""Author "%(author)s" contains %(nb_comma)s comma.\n\
The correct format for authors is:\n\n\
"Name, Firstname Middlename"\n\
or\n\
"Name, F M"\n\n\
Would you like to re-edit the reference?"""%{"nb_comma":author.count(','),"author":author}),\
_("Error in authors?"),\
style = wx.YES_NO, parent = self )
if ret == wx.YES: return False
elif author.find(".") != -1:
ret = wx.MessageBox(\
_("""Author "%(author)s" contains a period.\n\
The correct format for authors is:\n\n\
"Name, Firstname Middlename"\n\
or\n\
"Name, F M"\n\n\
Would you like to re-edit the reference?"""%{"nb_comma":author.count(','),"author":author}),\
_("Error in authors?"),\
style = wx.YES_NO, parent = self )
if ret == wx.YES: return False
elif len(author) > BIB.AUTHORTOLONG:
ret = wx.MessageBox(\
_("""Author "%(author)s" is very long.\n\
The correct format for authors is:\n\n\
"Name1, FirstName1 MiddleName1\n\
Name2, FirstName2 MiddleName2"\n\
or\n\
"Name1, FM\n\
Name2, FM"\n\n\
Would you like to re-edit the reference?"""%{"author":author}),\
_("Error in authors?"),\
style = wx.YES_NO, parent = self )
if ret == wx.YES: return False
return True
def getCurrentRef(self):
"""Return the current values entered by user"""
ref=self.ref_id[0:1]
ref.append( self.value['Identifier'].GetValue() )
ref.append( BIB.BIBLIOGRAPHIC_TYPE[BIB.TYPE_NAME[self.value['BibliographicType'].GetStringSelection()]] )
for item in BIB.BIB_FIELDS[3:]:
ref.append( self.value[item].GetValue() )
# we replace back \n with ; in Authors adn Editors and we remove empty lines
authors = ref[BIB.BIBLIOGRAPHIC_FIELDS['Author']].split("\n")
tmp = []
for author in authors:
if author.strip(): tmp.append(author.strip())
ref[BIB.BIBLIOGRAPHIC_FIELDS['Author']] = BIB.SEP.join( tmp )
editors = ref[BIB.BIBLIOGRAPHIC_FIELDS['Editor']].split("\n")
tmp = []
for editor in editors:
if editor.strip(): tmp.append(editor.strip())
ref[BIB.BIBLIOGRAPHIC_FIELDS['Editor']] = BIB.SEP.join( tmp )
#
return ref
def __OnOK(self,event):
#if self.Validate() and self.TransferDataFromWindow(): # not needed since no validator (crash on W98)
# self.SetReturnCode(wx.ID_OK) # not a dialog anymore (because we added a menu bar)
if self.__checkAuthors( self.value['Author'].GetValue() ):
self.notebook_1.AdvanceSelection() # This generate a pagechanging event => synchronize URL and first field of Tab file if needed
ref = self.getCurrentRef()
if ref[0] != None:
ref_id = ref[0]
self.db.modifyRef(BIB.BIB_FIELDS[1:],tuple(ref[1:]),ref[0])
newIdentifier = self.db.getRef(ref[0],('Identifier',))[0][0]
if ref[1] and newIdentifier != ref[1]: # the Identifier has been changed
wx.MessageBox(_("The reference or the identifier was not unique. The reference identifier has been changed to %s")%newIdentifier)
else:
ref_id = self.db.writeRef(ref)
if ref_id != None:
self.db.writeLink((self.key,ref_id))
newIdentifier = self.db.getRef(ref_id,('Identifier',))[0][0]
if ref[1] and newIdentifier != ref[1]: # the Identifier has been changed
wx.MessageBox(_("The reference or the identifier was not unique. The reference identifier has been changed %s")%newIdentifier)
# writing file links
self.db.setFiles( ref_id, self.notebook_1_pane_4.getFiles()[1:] )
self.bibframe.keytree.SelectItem(self.selectedkey)
self.bibframe.keytree.KeySelect(self.selectedkey) # update the list
item = self.bibframe.reflist.FindItemData(-1, ref_id)
self.bibframe.reflist.Select(item,True)
self.bibframe.reflist.Focus(item)
self.bibframe.reflist.EnsureVisible(item)
self.Close(True)
def __set_properties(self,ref):
self.SetTitle(_("Reference Editor"))
#self.SetSize((600, -1))
self.button_OK.SetDefault()
self.value['BibliographicType'].SetSelection(0) # select ARTICLE type by default
self.__set_fields_values(ref)
if ref:
self.label['Identifier'].SetValue(False) # if Identifier exists => not editable by default
self.value['Identifier'].Disable()
else:
self.label['Identifier'].SetValue(True) # if 'New Ref' => Identifier Editable by default
self.value['Identifier'].Enable(True)
def __set_fields_values(self,ref):
# set fields values
if ref:
self.value['BibliographicType'].SetStringSelection(BIB.NAME_TYPE[BIB.BIB_TYPE[self.bib_type]])
for item in BIB.BIB_FIELDS[3:]: self.value[item].SetValue( ref[BIB.BIBLIOGRAPHIC_FIELDS[item]] )
if type(ref[BIB.BIBLIOGRAPHIC_FIELDS['Identifier']]) in (str,unicode):
self.value['Identifier'].SetValue( ref[BIB.BIBLIOGRAPHIC_FIELDS['Identifier']] )
# We use \n instead of ; to separate authors for readibility
self.value['Author'].SetValue( '\n'.join(self.value['Author'].GetValue().split(BIB.SEP)) )
self.value['Editor'].SetValue( '\n'.join(self.value['Editor'].GetValue().split(BIB.SEP)) )
def __do_layout(self,x,y,width):
"""width = width of the dialog"""
sizer_10 = wx.BoxSizer(wx.VERTICAL)
sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
grid_sizer_1 = wx.FlexGridSizer(3+len(BIB.EDIT[BIB.BIB_TYPE[self.bib_type]][0]), 2, 0, 0)
grid_sizer_2 = wx.FlexGridSizer(len(BIB.EDIT[BIB.BIB_TYPE[self.bib_type]][1]), 2, 0, 0)
grid_sizer_3 = wx.FlexGridSizer(len(BIB.BIB_FIELDS)-4-len(BIB.EDIT[BIB.BIB_TYPE[self.bib_type]][0])-len(BIB.EDIT[BIB.BIB_TYPE[self.bib_type]][1]), 2, 0, 0)
# pane_1
#grid_sizer_1.Add(self.label['BibliographicType'], 0, 0, 0)
#grid_sizer_1.Add(self.value['BibliographicType'], 0, 0, 0)
grid_sizer_1.AddGrowableRow(len(BIB.EDIT[BIB.BIB_TYPE[self.bib_type]][0])+2)
grid_sizer_1.AddGrowableCol(1)
for item in ('BibliographicType','Identifier',)+BIB.EDIT[BIB.BIB_TYPE[self.bib_type]][0]:
grid_sizer_1.Add(self.label[item], 0, wx.ALL, 3)
grid_sizer_1.Add(self.value[item], 0, wx.EXPAND, 0)
grid_sizer_1.Add(self.label['Abstract'], 0, wx.ALL,3)
grid_sizer_1.Add(self.value['Abstract'], 1, wx.EXPAND, 0)
self.notebook_1_pane_1.SetAutoLayout(1)
self.notebook_1_pane_1.SetSizer(grid_sizer_1)
#grid_sizer_1.Fit(self.notebook_1_pane_1)
grid_sizer_1.SetSizeHints(self.notebook_1_pane_1)
# pane_2
for item in BIB.EDIT[BIB.BIB_TYPE[self.bib_type]][1]:
grid_sizer_2.Add(self.label[item], 0, wx.ALL, 3)
grid_sizer_2.Add(self.value[item], 1, wx.EXPAND, 0)
grid_sizer_2.AddGrowableCol(1)
self.notebook_1_pane_2.SetAutoLayout(1)
self.notebook_1_pane_2.SetSizer(grid_sizer_2)
#grid_sizer_2.Fit(self.notebook_1_pane_2)
grid_sizer_2.SetSizeHints(self.notebook_1_pane_2)
# pane_3
for item in BIB.BIB_FIELDS:
if item not in BIB.EDIT[BIB.BIB_TYPE[self.bib_type]][0]+BIB.EDIT[BIB.BIB_TYPE[self.bib_type]][1]+('Id','Identifier','BibliographicType','Abstract'):
grid_sizer_3.Add(self.label[item], 0, wx.ALL, 3)
grid_sizer_3.Add(self.value[item], 1, wx.EXPAND, 0)
grid_sizer_3.AddGrowableCol(1)
self.notebook_1_pane_3.SetAutoLayout(1)
self.notebook_1_pane_3.SetSizer(grid_sizer_3)
#grid_sizer_3.Fit(self.notebook_1_pane_3)
grid_sizer_3.SetSizeHints(self.notebook_1_pane_3)
#
self.notebook_1.AddPage(self.notebook_1_pane_1, _("Main Fields"))
self.notebook_1.AddPage(self.notebook_1_pane_2, _("Supplementary Fields"))
self.notebook_1.AddPage(self.notebook_1_pane_3, _("Other Fields"))
self.notebook_1.AddPage(self.notebook_1_pane_4, _("Fulltext Files"))
if wx.VERSION[:2] >= (2,6): # wx.NotebookSizer no more needed with wx.Python2.6
sizer_10.Add(self.notebook_1, 1, wx.EXPAND, 0)
else:
sizer_10.Add(wx.NotebookSizer(self.notebook_1), 1, wx.EXPAND, 0)
sizer_3.Add(self.button_Cancel, 0, wx.ALL, 10)
sizer_3.Add(self.button_OK, 0, wx.ALL, 10)
sizer_10.Add(sizer_3, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
#
self.SetAutoLayout(1)
self.SetSizer(sizer_10)
sizer_10.Fit(self)
#sizer_10.SetSizeHints(self)
self.SetDimensions(x, y, width, -1)
self.Layout()
# end of class RefEditor
|