Пример #1
0
def main(allowed_options=None, description=None, usage=None):
    from os import getcwd
    from sys import argv
    from optparse import OptionParser
    from rabbitvcs.util.helper import get_common_directory
    
    parser = OptionParser(usage=usage, description=description)
    
    if allowed_options:
        for (option_args, option_kwargs) in allowed_options:
            parser.add_option(*option_args, **option_kwargs)
        
    (options, args) = parser.parse_args(argv)
    
    # Convert "." to current working directory
    paths = args[1:]
    for i in range(0, len(paths)):
        if paths[i] == ".":
            paths[i] = getcwd()
        
    if not paths:
        paths = [getcwd()]
        
    if parser.has_option("--base-dir") and not options.base_dir: 
        options.base_dir = get_common_directory(paths)
        
    return (options, paths)
Пример #2
0
def main(allowed_options=None, description=None, usage=None):
    from os import getcwd
    from sys import argv
    from optparse import OptionParser
    from rabbitvcs.util.helper import get_common_directory
    
    parser = OptionParser(usage=usage, description=description)
    
    if allowed_options:
        for (option_args, option_kwargs) in allowed_options:
            parser.add_option(*option_args, **option_kwargs)
        
    (options, args) = parser.parse_args(argv)
    
    # Convert "." to current working directory
    paths = args[1:]
    for i in range(0, len(paths)):
        if paths[i] == ".":
            paths[i] = getcwd()
        
    if not paths:
        paths = [getcwd()]
        
    if parser.has_option("--base-dir") and not options.base_dir: 
        options.base_dir = get_common_directory(paths)
        
    return (options, paths)
Пример #3
0
    def __init__(self, paths, base_dir):
        """

        @type  paths:   list of strings
        @param paths:   A list of local paths.

        """

        InterfaceView.__init__(self, "commit", "Commit")

        # Modify the Commit window to what we need for Create Patch
        window = self.get_widget("Commit")
        window.set_title(_("Create Patch"))
        window.resize(640, 400)
        self.get_widget("commit_to_box").hide()
        self.get_widget("add_message_box").hide()

        self.paths = paths
        self.base_dir = base_dir
        self.vcs = rabbitvcs.vcs.VCS()
        self.activated_cache = {}

        self.common = helper.get_common_directory(paths)

        if not self.vcs.is_versioned(self.common):
            rabbitvcs.ui.dialog.MessageBox(
                _("The given path is not a working copy"))
            raise SystemExit()

        self.files_table = rabbitvcs.ui.widget.Table(
            self.get_widget("files_table"), [
                GObject.TYPE_BOOLEAN, rabbitvcs.ui.widget.TYPE_PATH,
                GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING
            ], [
                rabbitvcs.ui.widget.TOGGLE_BUTTON,
                _("Path"),
                _("Extension"),
                _("Text Status"),
                _("Property Status")
            ],
            filters=[{
                "callback": rabbitvcs.ui.widget.path_filter,
                "user_data": {
                    "base_dir": base_dir,
                    "column": 1
                }
            }],
            callbacks={
                "row-activated": self.on_files_table_row_activated,
                "mouse-event": self.on_files_table_mouse_event,
                "key-event": self.on_files_table_key_event
            },
            flags={
                "sortable": True,
                "sort_on": 1
            })
        self.files_table.allow_multiple()

        self.items = None
        self.initialize_items()
Пример #4
0
    def __init__(self, paths, base_dir):
        """

        @type  paths:   list of strings
        @param paths:   A list of local paths.

        """

        InterfaceView.__init__(self, "commit", "Commit")

        # Modify the Commit window to what we need for Create Patch
        window = self.get_widget("Commit")
        window.set_title(_("Create Patch"))
        window.resize(640, 400)
        self.get_widget("commit_to_box").hide()
        self.get_widget("add_message_box").hide()

        self.paths = paths
        self.base_dir = base_dir
        self.vcs = rabbitvcs.vcs.VCS()
        self.activated_cache = {}

        self.common = helper.get_common_directory(paths)

        if not self.vcs.is_versioned(self.common):
            rabbitvcs.ui.dialog.MessageBox(_("The given path is not a working copy"))
            raise SystemExit()

        self.files_table = rabbitvcs.ui.widget.Table(
            self.get_widget("files_table"),
            [GObject.TYPE_BOOLEAN, rabbitvcs.ui.widget.TYPE_PATH,
                GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING],
            [rabbitvcs.ui.widget.TOGGLE_BUTTON, _("Path"), _("Extension"),
                _("Text Status"), _("Property Status")],
            filters=[{
                "callback": rabbitvcs.ui.widget.path_filter,
                "user_data": {
                    "base_dir": base_dir,
                    "column": 1
                }
            }],
            callbacks={
                "row-activated":  self.on_files_table_row_activated,
                "mouse-event":   self.on_files_table_mouse_event,
                "key-event":     self.on_files_table_key_event
            },
            flags={
                "sortable": True,
                "sort_on": 1
            }
        )
        self.files_table.allow_multiple()

        self.items = None
        self.initialize_items()
Пример #5
0
    def choose_patch_path(self):
        path = ""

        dialog = gtk.FileChooserDialog(_("Create Patch"), None,
                                       gtk.FILE_CHOOSER_ACTION_SAVE,
                                       (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                        gtk.STOCK_SAVE, gtk.RESPONSE_OK))
        dialog.set_do_overwrite_confirmation(True)
        dialog.set_default_response(gtk.RESPONSE_OK)
        dialog.set_current_folder_uri(
            get_common_directory(self.paths).replace("file://", ""))
        response = dialog.run()

        if response == gtk.RESPONSE_OK:
            path = dialog.get_filename()

        dialog.destroy()

        return path
    def choose_patch_path(self):
        path = ""

        dialog = Gtk.FileChooserDialog(title=_("Create Patch"),
                                       parent=None,
                                       action=Gtk.FileChooserAction.SAVE)
        dialog.add_button(_("_Cancel"), Gtk.ResponseType.CANCEL)
        dialog.add_button(_("_Create"), Gtk.ResponseType.OK)
        dialog.set_do_overwrite_confirmation(True)
        dialog.set_default_response(Gtk.ResponseType.OK)
        dialog.set_current_folder_uri(
            helper.get_common_directory(self.paths).replace("file://", ""))
        response = dialog.run()

        if response == Gtk.ResponseType.OK:
            path = dialog.get_filename()

        dialog.destroy()

        return path
Пример #7
0
 def choose_patch_path(self):
     path = ""
     
     dialog = gtk.FileChooserDialog(
         _("Create Patch"),
         None,
         gtk.FILE_CHOOSER_ACTION_SAVE,(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                       gtk.STOCK_SAVE, gtk.RESPONSE_OK))
     dialog.set_do_overwrite_confirmation(True)
     dialog.set_default_response(gtk.RESPONSE_OK)
     dialog.set_current_folder_uri(
         get_common_directory(self.paths).replace("file://", "")
     )
     response = dialog.run()
     
     if response == gtk.RESPONSE_OK:
         path = dialog.get_filename()
         
     dialog.destroy()
     
     return path
Пример #8
0
    def choose_patch_path(self):
        path = ""

        dialog = Gtk.FileChooserDialog(
            title = _("Create Patch"),
            parent = None,
            action = Gtk.FileChooserAction.SAVE)
        dialog.add_button(_("_Cancel"), Gtk.ResponseType.CANCEL)
        dialog.add_button(_("_Create"), Gtk.ResponseType.OK)
        dialog.set_do_overwrite_confirmation(True)
        dialog.set_default_response(Gtk.ResponseType.OK)
        dialog.set_current_folder_uri(
            helper.get_common_directory(self.paths).replace("file://", "")
        )
        response = dialog.run()

        if response == Gtk.ResponseType.OK:
            path = dialog.get_filename()

        dialog.destroy()

        return path
 def __init__(self, paths):
     InterfaceNonView.__init__(self)
     self.paths = paths
     self.vcs = rabbitvcs.vcs.VCS()
     self.common = helper.get_common_directory(paths)