当前位置: 首页>>代码示例>>Python>>正文


Python Environment.get_sandbox_dir方法代码示例

本文整理汇总了Python中pyasm.common.Environment.get_sandbox_dir方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.get_sandbox_dir方法的具体用法?Python Environment.get_sandbox_dir怎么用?Python Environment.get_sandbox_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyasm.common.Environment的用法示例。


在下文中一共展示了Environment.get_sandbox_dir方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_display

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_sandbox_dir [as 别名]
    def get_display(my):

        top = my.top
        my.set_as_panel(top)
        top.add_class("spt_checkout_top")
        top.add_color("background", "background")
        top.add_style("width: 800px")

        inner = DivWdg()
        top.add(inner)

        snapshot_codes = my.kwargs.get("snapshot_codes")
        search_keys = my.kwargs.get("search_keys")

        if snapshot_codes:
            if isinstance(snapshot_codes, basestring):
                snapshots_codes = eval(snapshot_codes)

            search = Search("sthpw/snapshot")
            search.add_filters("code", snapshot_codes)
            snapshots = search.get_sobjects()
        elif search_keys:

            if isinstance(search_keys, basestring):
                search_keys = eval(search_keys)

            sobjects = Search.get_by_search_keys(search_keys)
            snapshots = []
            for sobject in sobjects:
                snapshot = Snapshot.get_latest_by_sobject(sobject, process="publish")
                if snapshot:
                    snapshots.append(snapshot)

            snapshot_codes = []
            for snapshot in snapshots:
                snapshot_codes.append( snapshot.get("code") )

        if not snapshot_codes:
            no_snapshots_div = DivWdg()
            no_snapshots_div.add("No files in selection")
            inner.add(no_snapshots_div)
            return top


        sandbox_dir = Environment.get_sandbox_dir("default")
        project_code = Project.get_project_code()
        sandbox_dir = "%s/%s" % (sandbox_dir, project_code)

        base_dir = my.kwargs.get("base_dir")

        if base_dir:
            title_div = DivWdg()
            inner.add(title_div)
            title_div.add_color("background", "background3")
            title_div.add_color("color", "color3")
            title_div.add_style("padding", "15px")
            title_div.add_style("font-weight: bold")
            title_div.add("Path: %s" % base_dir)


        inner.add("Check-out to: %s" % sandbox_dir)


        button_div = ButtonRowWdg()
        inner.add(button_div)

        button = ButtonNewWdg(title="Refresh", icon=IconWdg.REFRESH)
        button_div.add(button)
        button.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_checkout_top");
            spt.panel.refresh(top)
            '''
        } )


        web = WebContainer.get_web()
        if web.use_applet():

            button = ButtonNewWdg(title="Check-out", icon=IconWdg.CHECK_OUT)
            button_div.add(button)

            button.add_behavior( {
                'type': 'click_up',
                'snapshot_codes': snapshot_codes,
                'cbjs_action': '''
                var top = bvr.src_el.getParent(".spt_checkout_top");
                var progress = top.getElement(".spt_checkout_progress");
                var message = top.getElement(".spt_checkout_message");
                var snapshot_codes = bvr.snapshot_codes;
                var num_snapshots = snapshot_codes.length;

                var server = TacticServerStub.get();

                for (var i = 0; i < snapshot_codes.length; i++) {
                    var snapshot_code = snapshot_codes[i];

                    var percent = parseInt( (i+1) / (num_snapshots-1) * 100);

#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:checkout_wdg.py

示例2: get_content_wdg

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_sandbox_dir [as 别名]
    def get_content_wdg(my):
        content = DivWdg()

        project = my.sobject.get_project()
        depot = project.get_value("location", no_exception=True)
        if not depot:
            depot = Config.get_value("perforce", "depot")
        if not depot:
            depot = ""

        branch = "r1.1"
        root_sandbox_dir = Environment.get_sandbox_dir()

        web = WebContainer.get_web()
        folder_state = web.get_form_value("folder_state")

        content.add_behavior( {
            'type': 'load',
            'folder_state': folder_state,
            'search_key': my.search_key,
            'sandbox_dir': my.sandbox_dir,
            'root_sandbox_dir': root_sandbox_dir,
            'depot': depot,
            'process': my.process,
            'branch': branch,
            'cbjs_action': '''

// set the sync root directory
spt.scm.sync_dir = bvr.root_sandbox_dir;
spt.scm.depot = bvr.depot;

// check to see if we are logged in
var is_logged_in = spt.scm.is_logged_in();
if (!is_logged_in) {
    spt.scm.show_login();
    return;
}


// check to see if we are logged in
/*
var is_logged_in = spt.scm.is_logged_in();
if (!is_logged_in) {
    spt.scm.show_login();
    return;
}
*/



var applet = spt.Applet.get();

if (! applet.exists(bvr.sandbox_dir)) {
    var class_name = 'tactic.ui.widget.CheckinSandboxNotExistsWdg';
    var kwargs = {
        'process': bvr.process,
        'sandbox_dir': bvr.sandbox_dir,
        // FIXME: missing create_sandbox_script_path
        'create_sandbox_script_path': ''
    }
    spt.panel.load(bvr.src_el, class_name, kwargs);
    return;
}


spt.app_busy.show("Reading Sync Folder ...");
var ret_val;
try {
    ret_val = spt.scm.status(bvr.sandbox_dir);
} catch(e) {
    ret_val = {};
}

var paths = [];
var sizes = [];
for (var path in ret_val) {
    paths.push(path);
}
paths = paths.sort();
for (var i = 0; i < paths.length; i++) {
    if (applet.is_dir(paths[i])) {
        paths[i] = paths[i] + "/";
    }
    else {
        if (applet.exists(paths[i])) {
            var path_info = applet.get_path_info(paths[i]);
            var size = path_info.size;
            sizes.push(size);
        }
        else {
            sizes.push(-1);
        }
    }
}


spt.app_busy.show("Loading display ...");
var class_name = 'tactic.ui.checkin.ScmDirListWdg';
var kwargs = {
    path_info: ret_val,
#.........这里部分代码省略.........
开发者ID:blezek,项目名称:TACTIC,代码行数:103,代码来源:scm_dir_list_wdg.py

示例3: get_display

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_sandbox_dir [as 别名]
    def get_display(my):

        top = my.top
        top.add_class("spt_changelist_content")
        my.set_as_panel(top)
        top.add_color("color", "color")
        top.add_color("background", "background")
        #top.add_border()
        #top.add_style("padding", "10px")
        top.add_style("min-width: 600px")
        top.add_style("min-height: 400px")

        top.add_behavior( {
            'type': 'load',
            'cbjs_action': scm_get_onload_js()
        } )



        sync_dir = Environment.get_sandbox_dir()
        # HARD CODED
        project = Project.get()
        depot = project.get_value("location", no_exception=True)
        if not depot:
            depot = project.get_code()
        location = '//%s' % depot


        changelist = my.kwargs.get("changelist")
        if not changelist:
            changelist = WidgetSettings.get_value_by_key("current_changelist")
        else:
            WidgetSettings.set_value_by_key("current_changelist", changelist)

        if not changelist:
            changelist = 'default'


        changelists = my.kwargs.get("changelists")
        if not changelists:
            changelists = []
        elif isinstance(changelists, basestring):
            changelists = changelists.replace("'", '"')
            changelists = jsonloads(changelists)

        top.add_behavior( {
            'type': 'load',
            'sync_dir': sync_dir,
            'depot': depot,
            'cbjs_action': '''
            spt.scm.sync_dir = bvr.sync_dir;
            spt.scm.depot = bvr.depot;
            '''
        } )



        inner = DivWdg()
        top.add(inner)

        table = Table()
        inner.add(table)
        table.add_style("width: 100%")
        table.add_color("background", "background", -3)

        table.add_row()
        th = table.add_header("")

        th = table.add_header("Changelist")
        th.add_style("text-align: left")
        th = table.add_header("Description")
        th.add_style("text-align: left")
        th = table.add_header("# Items")
        th.add_style("text-align: left")
        th = table.add_header("Status")
        th.add_style("text-align: left")
        th = table.add_header("View")
        th.add_style("text-align: left")
        th = table.add_header("Delete")
        th.add_style("text-align: left")
        #table.set_unique_id()
        #table.add_smart_styles("spt_changelist_item", {
        #    'text-align: right'
        #    } ))

        bgcolor = table.get_color("background", -8)
        table.add_relay_behavior( {
            'type': 'mouseover',
            'bvr_match_class': 'spt_changelist_item',
            'bgcolor': bgcolor,
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", bvr.bgcolor);
            '''
        } )
        table.add_relay_behavior( {
            'type': 'mouseout',
            'bvr_match_class': 'spt_changelist_item',
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", '');
            '''
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:changelist_wdg.py

示例4: get_display

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_sandbox_dir [as 别名]
    def get_display(my):

        my.sobject = my.kwargs.get("sobject")
        search_key = my.sobject.get_search_key()

        top = DivWdg()
        top.add_class("spt_checkin_publish")
        top.add_style("padding: 10px")

        margin_top = '60px'
        top.add_style("margin-top", margin_top)
        top.add_style("position: relative")


        current_changelist = WidgetSettings.get_value_by_key("current_changelist")
        current_branch = WidgetSettings.get_value_by_key("current_branch")
        current_workspace = WidgetSettings.get_value_by_key("current_workspace")

        top.add("Branch: %s<br/>" % current_branch)
        top.add("Changelist: %s<br/>" % current_changelist)
        top.add("Workspace: %s<br/>" % current_workspace)
        top.add("<br/>")


        checked_out_div = DivWdg()
        checkbox = CheckboxWdg("editable")
        top.add(checked_out_div)
        checkbox.add_class("spt_checkin_editable")
        checked_out_div.add(checkbox)
        checked_out_div.add("Leave files editable")

        top.add("<br/>")

        top.add("Publish Description<br/>")
        text = TextAreaWdg("description")
        # this needs to be set or it will stick out to the right
        text.add_style("width: 220px")
        text.add_class("spt_checkin_description")
        top.add(text)


        # add as a note
        note_div = DivWdg()
        top.add(note_div)
        note_div.add_class("spt_add_note")
        checkbox = CheckboxWdg("add_note")

        web = WebContainer.get_web()
        browser = web.get_browser()
        if browser in ['Qt']:
            checkbox.add_style("margin-top: -4px")
            checkbox.add_style("margin-right: 3px")
            note_div.add_style("margin-top: 3px")



        checkbox.add_class("spt_checkin_add_note")
        note_div.add(checkbox)
        note_div.add("Also add as note")

        top.add("<br/><br/>")


        button = ActionButtonWdg(title="Check-in", icon=IconWdg.PUBLISH, size='medium')
        top.add(button)

        my.repo_type = 'perforce'
        if my.repo_type == 'perforce':

            # the depot is set per project (unless overridden)
            project = my.sobject.get_project()
            depot = project.get_value("location", no_exception=True)
            if not depot:
                depot = project.get_code()

            asset_dir = Environment.get_asset_dir()
            sandbox_dir = Environment.get_sandbox_dir()
           
            changelist = WidgetSettings.get_value_by_key("current_changelist")
            button.add_behavior( {
            'type': 'click_up',
            'depot': depot,
            'changelist': changelist,
            'sandbox_dir': sandbox_dir,
            'search_key': search_key,
            'cbjs_action': '''

            var paths = spt.checkin.get_selected_paths();
            spt.app_busy.show("Checking in "+paths.length+" file/s into Perforce");
            var top = bvr.src_el.getParent(".spt_checkin_top");
            var description = top.getElement(".spt_checkin_description").value;
            var add_note = top.getElement(".spt_checkin_add_note").value;
            var editable = top.getElement(".spt_checkin_editable").value;

            if (editable == 'on') {
                editable = true;
            }
            else {
                editable = false;
            }
#.........这里部分代码省略.........
开发者ID:blezek,项目名称:TACTIC,代码行数:103,代码来源:scm_dir_list_wdg.py

示例5: preprocess

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_sandbox_dir [as 别名]
    def preprocess(my):
        # find out if there is a snapshot associated with this path
        #print "sobject: ", my.sobject

        #context = "design/%s" % basename
        #search = Search("sthpw/snapshot")
        #search.add_filter("context", context)
        #my.sobject = search.get_sobject()

        search_key = my.kwargs.get("search_key")
        my.sobject = Search.get_by_search_key(search_key)

        md5s = my.kwargs.get("md5s")
        sizes = my.kwargs.get("sizes")

        # bit of a hack get the file system paths
        spaths = []
        my.md5s = {}
        my.sizes = {}
        for i, path in enumerate(my.paths):
            #path = Common.get_filesystem_name(path)
            #new_path = path.replace(" ", "_")
            new_path = path
            spaths.append(new_path)

            my.md5s[new_path] = md5s.get(path)
            my.sizes[new_path] = sizes.get(path)


        process = my.kwargs.get("process")

        # need to match up files 
        search = Search("sthpw/file")
        search.add_sobject_filter(my.sobject)
        snapshots = []
        if process:
            search2 = Search("sthpw/snapshot")
            search2.add_filter("process", process)
            search2.add_filter("is_latest", True)
            search2.add_sobject_filter(my.sobject)
            snapshots = search2.get_sobjects()
            search.add_relationship_search_filter(search2)
        #search.add_filters("source_path", spaths)
        sobjects = search.get_sobjects()

        my.snapshots_dict = {}
        for snapshot in snapshots:
            my.snapshots_dict[snapshot.get_code()] = snapshot


        my.base_dir = my.kwargs.get("base_dir")
        my.checked_in_paths = {}
        for sobject in sobjects:
            source_path = sobject.get_value("source_path")
            if not source_path:
                print "WARNING: source_path for file [%s] is empty" % sobject.get_code()
                continue
            my.checked_in_paths[source_path] = sobject

            relative_dir = sobject.get_value("relative_dir")
            file_name = sobject.get_value("file_name")
            file_name = os.path.basename(source_path)
            relative_path = "%s/%s" % (relative_dir, file_name)

            sandbox_dir = Environment.get_sandbox_dir()
            sandbox_path = "%s/%s" % (sandbox_dir, relative_path)
            my.checked_in_paths[sandbox_path] = sobject



        # this is advanced option
        my.context_options = my.kwargs.get("context_options")

        my.subcontext_options = my.kwargs.get("subcontext_options")
        if not my.subcontext_options:
            my.subcontext_options = []


        my.preselected = my.kwargs.get("preselected")
开发者ID:lucasnemeth,项目名称:TACTIC,代码行数:81,代码来源:checkin_dir_list_wdg.py

示例6: get_display

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_sandbox_dir [as 别名]
    def get_display(my):

        top = my.top
        top.add_class("spt_branch_content")
        my.set_as_panel(top)
        top.add_color("color", "color")
        top.add_color("background", "background")
        #top.add_border()
        #top.add_style("padding", "10px")
        top.add_style("min-width: 600px")
        top.add_style("min-height: 400px")

        top.add_behavior( {
            'type': 'load',
            'cbjs_action': scm_get_onload_js()
        } )



        sync_dir = Environment.get_sandbox_dir()
        project = Project.get()
        depot = project.get_value("location", no_exception=True)
        if not depot:
            depot = project.get_code()
        location = '//%s' % depot


        branch = my.kwargs.get("branch")
        if not branch:
            branch = WidgetSettings.get_value_by_key("current_branch")
        else:
            WidgetSettings.set_value_by_key("current_branch", branch)

        if not branch:
            branch = 'main'


        branches = my.kwargs.get("branches")
        if not branches:
            branches = []
        elif isinstance(branches, basestring):
            branches = branches.replace("'", '"')
            branches = jsonloads(branches)

        top.add_behavior( {
            'type': 'load',
            'depot': depot,
            'sync_dir': sync_dir,
            'cbjs_action': '''
            spt.scm.sync_dir = bvr.sync_dir;
            spt.scm.depot = bvr.depot;
            '''
        } )



        inner = DivWdg()
        top.add(inner)

        table = Table()
        inner.add(table)
        table.add_style("width: 100%")

        table.add_row()
        th = table.add_header("")

        th = table.add_header("Branches")
        th.add_style("text-align: left")
        th = table.add_header("Options")
        th.add_style("text-align: left")
        th = table.add_header("Owner")
        th.add_style("text-align: left")
        th = table.add_header("Check-out")
        th.add_style("text-align: left")

        bgcolor = table.get_color("background", -8)
        table.add_relay_behavior( {
            'type': 'mouseover',
            'bvr_match_class': 'spt_branch_item',
            'bgcolor': bgcolor,
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", bvr.bgcolor);
            '''
        } )
        table.add_relay_behavior( {
            'type': 'mouseout',
            'bvr_match_class': 'spt_branch_item',
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", '');
            '''
        } )


        table.add_relay_behavior( {
            'type': 'mouseup',
            'bvr_match_class': "spt_branch_radio",
            'cbjs_action': '''
            var value = bvr.src_el.value;


#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:branch_wdg.py

示例7: get_display

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_sandbox_dir [as 别名]
    def get_display(my):

        top = my.top
        top.add_class("spt_workspace_content")
        my.set_as_panel(top)
        top.add_color("color", "color")
        top.add_color("background", "background")
        top.add_style("min-width: 600px")
        top.add_style("min-height: 400px")


        # NOTE: is there ever a time when this is not loaded already?
        top.add_behavior( {
            'type': 'load',
            'cbjs_action': scm_get_onload_js()
        } )



        sync_dir = Environment.get_sandbox_dir()
        project = Project.get()
        depot = project.get_value("location", no_exception=True)
        if not depot:
            depot = project.get_code()
        location = '//%s' % depot


        workspace = my.kwargs.get("workspace")
        if not workspace:
            workspace = WidgetSettings.get_value_by_key("current_workspace")
        else:
            WidgetSettings.set_value_by_key("current_workspace", workspace)

        if not workspace:
            workspace = 'main'


        workspaces = my.kwargs.get("workspaces")
        if not workspaces:
            workspaces = []
        elif isinstance(workspaces, basestring):
            workspaces = workspaces.replace("'", '"')
            workspaces = jsonloads(workspaces)

        top.add_behavior( {
            'type': 'load',
            'depot': depot,
            'sync_dir': sync_dir,
            'cbjs_action': '''
            spt.scm.sync_dir = bvr.sync_dir;
            spt.scm.depot = bvr.depot;
            '''
        } )



        inner = DivWdg()
        top.add(inner)

        table = Table()
        inner.add(table)
        table.add_style("width: 100%")

        table.add_row()
        th = table.add_header("")



        th = table.add_header("Workspaces")
        th.add_style("text-align: left")
        th = table.add_header("Description")
        th.add_style("text-align: left")
        th = table.add_header("Owner")
        th.add_style("text-align: left")
        th = table.add_header("Root")
        th.add_style("text-align: left")


        bgcolor = table.get_color("background", -8)
        table.add_relay_behavior( {
            'type': 'mouseover',
            'bvr_match_class': 'spt_workspace_item',
            'bgcolor': bgcolor,
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", bvr.bgcolor);
            '''
        } )


        table.add_relay_behavior( {
            'type': 'mouseout',
            'bvr_match_class': 'spt_workspace_item',
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", '');
            '''
        } )


        table.add_relay_behavior( {
            'type': 'mouseup',
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:workspace_wdg.py


注:本文中的pyasm.common.Environment.get_sandbox_dir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。