def append_items_to_tree(self, items):

        # file_dir_tuple = split_files_and_dirs(items)
        # print(file_dir_tuple)

        self.dropTreeWidget.clearSelection()

        if len(items) > 1:
            self.groupCheckinCheckBox.setChecked(True)
        if len(items) == 1:
            self.groupCheckinCheckBox.setChecked(False)

        for item in items:
            tree_item = QtGui.QTreeWidgetItem()
            tree_item.setText(0, gf.extract_filename(item))
            tree_item.setText(1, gf.extract_extension(item)[1])
            tree_item.setData(1, QtCore.Qt.UserRole, gf.extract_extension(item)[0])
            tree_item.setText(2, gf.extract_dirname(item))
            self.dropTreeWidget.addTopLevelItem(tree_item)
            self.dropTreeWidget.setItemSelected(tree_item, True)

        self.dropTreeWidget.resizeColumnToContents(0)
        self.dropTreeWidget.resizeColumnToContents(1)
        self.dropTreeWidget.resizeColumnToContents(2)
        self.dropTreeWidget.resizeColumnToContents(3)
 def browse_for_preview(self):
     options = QtGui.QFileDialog.Options()
     options |= QtGui.QFileDialog.DontUseNativeDialog
     file_name, filter = QtGui.QFileDialog.getOpenFileName(
         self, 'Browse for Preview Image', self.text_edit.text(),
         'All Images (*.jpg | *.jpeg | *.png | *.tif);;'
         'JPEG Files (*.jpg | *.jpeg);;'
         'PNG Files (*.png)'
         'TIF Files (*.tif)', '', options)
     if file_name:
         ext = gf.extract_extension(file_name)
         if ext[3] == 'preview':
             self.text_edit.setText(file_name)
    def checkin_from_path(self, search_key, context, description, explicit_paths=None):

        if explicit_paths:
            update_versionless = bool(self.checkin_options_widget.updateVersionlessCheckBox.isChecked())

            repo = self.get_current_repo()

            file_types = []
            file_names = []
            file_paths = []
            exts = []
            file_sizes = []

            for path in explicit_paths:
                file_types.append('main')
                file_names.append(gf.extract_filename(path))
                exts.append(gf.extract_extension(path)[0])
                file_path = gf.form_path(path)
                file_paths.append(file_path)
                file_sizes.append(gf.get_st_size(file_path))

            mode = 'inplace'

            create_icon = False
            if context == 'icon':
                create_icon = True

            return tc.checkin_file(
                search_key=search_key,
                context=context,
                description=description,
                version=None,
                update_versionless=update_versionless,
                file_types=file_types,
                file_names=file_names,
                file_paths=file_paths,
                file_sizes=file_sizes,
                exts=exts,
                keep_file_name=False,
                repo_name=repo,
                mode=mode,
                create_icon=create_icon
            )
 def fill_text_edit(self, links_list):
     # for link in links_list:
     ext = gf.extract_extension(links_list[0])
     if ext[3] == 'preview':
         self.text_edit.setText(links_list[0])