| 1 |
nino.borges |
270 |
"""
|
| 2 |
|
|
|
| 3 |
|
|
EditVendorFolderDialog
|
| 4 |
|
|
|
| 5 |
|
|
Created by
|
| 6 |
|
|
Emanuel Borges
|
| 7 |
|
|
02.04.2013
|
| 8 |
|
|
|
| 9 |
|
|
This dialog will let you attach, remove and edit vendor folders in the case.
|
| 10 |
|
|
|
| 11 |
|
|
"""
|
| 12 |
|
|
|
| 13 |
|
|
|
| 14 |
|
|
import wx, os
|
| 15 |
|
|
|
| 16 |
|
|
class EditVendorFolderDialog(wx.Dialog):
|
| 17 |
nino.borges |
271 |
def __init__(self, parent,currentVendorFolder,vendorFolderList):
|
| 18 |
nino.borges |
270 |
#self.CLM = CLM
|
| 19 |
|
|
self.parent = parent
|
| 20 |
|
|
wx.Dialog.__init__(self, parent, -1, "Add and Edit Vendor Folders", style = wx.DEFAULT_DIALOG_STYLE, size = (450,390))
|
| 21 |
nino.borges |
271 |
vendorFolderStaticText = wx.StaticText(self, -1, "Case Files Path:",wx.DefaultPosition)
|
| 22 |
|
|
self.vendorFolderChoice = wx.Choice(self,-1,choices=vendorFolderList)
|
| 23 |
|
|
self.vendorFolderChoice.SetStringSelection(currentVendorFolder)
|
| 24 |
nino.borges |
270 |
|
| 25 |
|
|
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
| 26 |
|
|
|
| 27 |
nino.borges |
271 |
vendorFolderSizer = wx.BoxSizer(wx.HORIZONTAL)
|
| 28 |
|
|
vendorFolderSizer.Add(vendorFolderStaticText,0,wx.ALL,5)
|
| 29 |
|
|
vendorFolderSizer.Add(self.vendorFolderChoice,0,wx.ALL,5)
|
| 30 |
nino.borges |
270 |
|
| 31 |
nino.borges |
271 |
mainSizer.Add(vendorFolderSizer,0,wx.ALL, 10)
|
| 32 |
|
|
|
| 33 |
nino.borges |
270 |
oKButton = wx.Button(self, wx.ID_OK)
|
| 34 |
|
|
oKButton.SetDefault()
|
| 35 |
|
|
cancelButton = wx.Button(self, wx.ID_CANCEL)
|
| 36 |
|
|
buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
|
| 37 |
|
|
buttonSizer.Add(oKButton,0,wx.ALL,5)
|
| 38 |
|
|
buttonSizer.Add(cancelButton,0,wx.ALL,5)
|
| 39 |
|
|
mainSizer.Add(buttonSizer, 0, wx.ALIGN_CENTER|wx.ALL, 15)
|
| 40 |
|
|
self.SetSizer(mainSizer)
|
| 41 |
|
|
|
| 42 |
|
|
|
| 43 |
nino.borges |
271 |
def GetValues(self):
|
| 44 |
|
|
return self.vendorFolderChoice.GetStringSelection()
|
| 45 |
|
|
#
|
| 46 |
|
|
# mainSizer = wx.BoxSizer(wx.VERTICAL)
|
| 47 |
|
|
#
|
| 48 |
|
|
# vendorListStaticBox = wx.StaticBox(self, -1, 'Right click to add and delete tags:')
|
| 49 |
|
|
# vendorListStaticBoxSizer = wx.StaticBoxSizer(vendorListStaticBox, wx.VERTICAL)
|
| 50 |
|
|
# self.vendorListBox = wx.ListCtrl(self,-1, style=wx.LC_REPORT|wx.LC_HRULES|wx.LC_NO_HEADER|wx.LC_EDIT_LABELS)
|
| 51 |
|
|
# self.vendorListBox.InsertColumn(0, 'Vendor Folders', format=wx.LIST_FORMAT_LEFT, width=200)
|
| 52 |
|
|
# vendorListStaticBoxSizer.Add(self.vendorListBox, 0, wx.EXPAND|wx.LEFT|wx.TOP|wx.RIGHT, 10)
|
| 53 |
|
|
# addButton = wx.Button(self, -1, "+", size=(30,20), style=wx.NO_BORDER)
|
| 54 |
|
|
# minusButton = wx.Button(self, -1, "-", size=(30,20), style=wx.NO_BORDER)
|
| 55 |
|
|
# addRemoveButtonSizer = wx.BoxSizer(wx.HORIZONTAL)
|
| 56 |
|
|
# addRemoveButtonSizer.Add(addButton, 0, wx.LEFT,3)
|
| 57 |
|
|
# addRemoveButtonSizer.Add(minusButton, 0, wx.LEFT,0)
|
| 58 |
|
|
# vendorListStaticBoxSizer.Add(addRemoveButtonSizer, 0, wx.LEFT,10)
|
| 59 |
|
|
#
|
| 60 |
|
|
# mainSizer.Add(vendorListStaticBoxSizer, 0, wx.EXPAND|wx.ALL, 20)
|
| 61 |
|
|
#
|
| 62 |
|
|
# oKButton = wx.Button(self, wx.ID_OK)
|
| 63 |
|
|
# oKButton.SetDefault()
|
| 64 |
|
|
# cancelButton = wx.Button(self, wx.ID_CANCEL)
|
| 65 |
|
|
# buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
|
| 66 |
|
|
# buttonSizer.Add(oKButton,0,wx.ALL,5)
|
| 67 |
|
|
# buttonSizer.Add(cancelButton,0,wx.ALL,5)
|
| 68 |
|
|
# mainSizer.Add(buttonSizer, 0, wx.ALIGN_CENTER|wx.ALL, 15)
|
| 69 |
|
|
# self.SetSizer(mainSizer)
|
| 70 |
|
|
#
|
| 71 |
|
|
# self.Bind(wx.EVT_BUTTON, self.OnPopupOne, addButton)
|
| 72 |
|
|
# self.Bind(wx.EVT_BUTTON, self.OnPopupTwo, minusButton)
|
| 73 |
|
|
#
|
| 74 |
|
|
# self.vendorListBox.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.OnRightClick)
|
| 75 |
|
|
# self.vendorListBox.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)
|
| 76 |
|
|
# self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected)
|
| 77 |
|
|
#
|
| 78 |
|
|
#def OnItemSelected(self, event):
|
| 79 |
|
|
# ##print event.GetItem().GetTextColour()
|
| 80 |
|
|
# self.currentItem = event.m_itemIndex
|
| 81 |
|
|
# #print self.currentItem
|
| 82 |
|
|
# #print self.tagListBox.GetItemCount()
|
| 83 |
|
|
#
|
| 84 |
|
|
#def OnRightDown(self, event):
|
| 85 |
|
|
# x = event.GetX()
|
| 86 |
|
|
# y = event.GetY()
|
| 87 |
|
|
# #self.log.WriteText("x, y = %s\n" % str((x, y)))
|
| 88 |
|
|
# item, flags = self.vendorListBox.HitTest((x, y))
|
| 89 |
|
|
#
|
| 90 |
|
|
# if item != wx.NOT_FOUND and flags & wx.LIST_HITTEST_ONITEM:
|
| 91 |
|
|
# self.vendorListBox.Select(item)
|
| 92 |
|
|
#
|
| 93 |
|
|
# event.Skip()
|
| 94 |
|
|
#
|
| 95 |
|
|
#def OnRightClick(self, event):
|
| 96 |
|
|
# #self.log.WriteText("OnRightClick %s\n" % self.list.GetItemText(self.currentItem))
|
| 97 |
|
|
#
|
| 98 |
|
|
# # only do this part the first time so the events are only bound once
|
| 99 |
|
|
# if not hasattr(self, "popupID1"):
|
| 100 |
|
|
# self.popupID1 = wx.NewId()
|
| 101 |
|
|
# self.popupID2 = wx.NewId()
|
| 102 |
|
|
#
|
| 103 |
|
|
#
|
| 104 |
|
|
# self.Bind(wx.EVT_MENU, self.OnPopupOne, id=self.popupID1)
|
| 105 |
|
|
# self.Bind(wx.EVT_MENU, self.OnPopupTwo, id=self.popupID2)
|
| 106 |
|
|
#
|
| 107 |
|
|
#
|
| 108 |
|
|
# # make a menu
|
| 109 |
|
|
# menu = wx.Menu()
|
| 110 |
|
|
# # add some items
|
| 111 |
|
|
# menu.Append(self.popupID1, "Add New Vendor Folder")
|
| 112 |
|
|
# menu.Append(self.popupID2, "Remove Selected Vendor Folder")
|
| 113 |
|
|
#
|
| 114 |
|
|
# # Popup the menu. If an item is selected then its handler
|
| 115 |
|
|
# # will be called before PopupMenu returns.
|
| 116 |
|
|
# self.PopupMenu(menu)
|
| 117 |
|
|
# menu.Destroy()
|
| 118 |
|
|
#
|
| 119 |
|
|
#
|
| 120 |
|
|
#def OnPopupOne(self, event):
|
| 121 |
|
|
# nextIndexNumb = self.tagListBox.GetItemCount()
|
| 122 |
|
|
# self.tagListBox.InsertStringItem(nextIndexNumb,"Reviewer_%s"% str(nextIndexNumb+1))
|
| 123 |
|
|
# self.tagListBox.SetItemState(nextIndexNumb, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
|
| 124 |
|
|
# #print "one"
|
| 125 |
|
|
#
|
| 126 |
|
|
#def OnPopupTwo(self, event):
|
| 127 |
|
|
# self.tagListBox.DeleteItem(self.currentItem) |