1 # BiaWeb Website content manager (c) 2010 V.Harishankar
7 import ui_generate_dialog
9 class GenerateDialog (PyQt4
.QtGui
.QDialog
, ui_generate_dialog
.Ui_SiteGenerateDialog
):
10 def __init__ (self
, master
, currentdb
):
11 PyQt4
.QtGui
.QDialog
.__init
__ (self
, master
)
15 self
.current_db
= currentdb
17 # when folder add is clicked
18 def onFolderAdd (self
):
19 folder_to_add
= PyQt4
.QtGui
.QFileDialog
.getExistingDirectory (self
,
20 "Folder whose contents to add to destination", os
.path
.expanduser ("~"))
25 dest_rel_path
, ok
= PyQt4
.QtGui
.QInputDialog
.getText (self
, "Desination",
26 "Copy to location (within destination path)")
30 folderitem
= PyQt4
.QtGui
.QTreeWidgetItem ([folder_to_add
, dest_rel_path
])
31 self
.additional_folders
.addTopLevelItem (folderitem
)
33 # when folder remove is clicked
34 def onFolderRemove (self
):
35 selitem
= self
.additional_folders
.currentItem ()
36 selindex
= self
.additional_folders
.indexOfTopLevelItem (selitem
)
40 self
.additional_folders
.takeTopLevelItem (selindex
)
43 # when file add is clicked
45 file_to_add
= PyQt4
.QtGui
.QFileDialog
.getOpenFileName (self
, "File to add to destination",
46 os
.path
.expanduser ("~"))
50 dest_rel_path
, ok
= PyQt4
.QtGui
.QInputDialog
.getText (self
, "Destination",
51 "Copy to location (within destination path)")
55 fileitem
= PyQt4
.QtGui
.QTreeWidgetItem ([file_to_add
, dest_rel_path
])
56 self
.additional_files
.addTopLevelItem (fileitem
)
58 # when file remove is clicked
59 def onFileRemove (self
):
60 selitem
= self
.additional_files
.currentItem ()
61 selindex
= self
.additional_files
.indexOfTopLevelItem (selitem
)
65 self
.additional_files
.takeTopLevelItem (selindex
)