### Install XMind SDK for Python using Git and Setup Source: https://github.com/xmindltd/xmind-sdk-python/blob/master/README.md Instructions for cloning the XMind SDK for Python repository and installing it using the setup.py script. It is recommended to use a virtual environment for installation. ```bash git clone https://github.com/xmindltd/xmind-sdk-python.git cd xmind-sdk-python python setup.py install ``` -------------------------------- ### Python: Build Product Roadmap XMind Source: https://context7.com/xmindltd/xmind-sdk-python/llms.txt A comprehensive example showing how to build a product roadmap mind map using the XMind SDK. It covers creating topics, adding markers, setting notes, adding hyperlinks, creating relationships, and saving the workbook. Requires the 'xmind' library. ```python import xmind from xmind.core.topic import TopicElement # Create new workbook workbook = xmind.load("product_roadmap.xmind") # Configure main sheet sheet = workbook.getPrimarySheet() sheet.setTitle("2024 Product Roadmap") root = sheet.getRootTopic() root.setTitle("Product Roadmap 2024") # Q1 Planning q1 = TopicElement() q1.setTitle("Q1: Foundation") q1.addMarker("month-jan") root.addSubTopic(q1) q1_features = [ ("User Authentication", "priority-1", "Implement OAuth2 and JWT tokens"), ("Database Migration", "priority-2", "Move to PostgreSQL cluster"), ("API Documentation", "priority-3", "Create OpenAPI specs") ] for title, marker, notes in q1_features: feature = TopicElement() feature.setTitle(title) feature.addMarker(marker) feature.addMarker("task-half") feature.setPlainNotes(notes) q1.addSubTopic(feature) # Q2 Planning q2 = TopicElement() q2.setTitle("Q2: Growth") q2.addMarker("month-apr") root.addSubTopic(q2) q2_features = [ ("Mobile App Launch", "priority-1", "iOS and Android native apps"), ("Analytics Dashboard", "priority-2", "Real-time metrics and insights"), ("Payment Integration", "priority-1", "Stripe and PayPal support") ] for title, marker, notes in q2_features: feature = TopicElement() feature.setTitle(title) feature.addMarker(marker) feature.addMarker("task-start") feature.setPlainNotes(notes) q2.addSubTopic(feature) # Resources section resources = TopicElement() resources.setTitle("Resources & Links") root.addSubTopic(resources) design_doc = TopicElement() design_doc.setTitle("Design Documentation") design_doc.setFileHyperlink("docs/design.pdf") resources.addSubTopic(design_doc) jira_link = TopicElement() jira_link.setTitle("JIRA Board") jira_link.setURLHyperlink("https://company.atlassian.net/board") resources.addSubTopic(jira_link) # Create relationships rel = sheet.createRelationship( q1.getID(), q2.getID(), "prerequisite for" ) sheet.addRelationship(rel) # Mark completed items completed_topics = root.getSubTopics() if completed_topics: for topic in completed_topics: if "Foundation" in topic.getTitle(): topic.addMarker("star-green") xmind.save(workbook, "product_roadmap.xmind") print("Product roadmap created successfully!") ``` -------------------------------- ### Load and Save XMind Files with Python Source: https://context7.com/xmindltd/xmind-sdk-python/llms.txt Demonstrates how to load an existing XMind file or create a new one if it doesn't exist, modify it, and then save it to a specified path using the XMind SDK for Python. This is a fundamental operation for any file manipulation. ```python import xmind # Load existing file or create new workbook workbook = xmind.load("my_mindmap.xmind") # Modify the workbook (add sheets, topics, etc.) sheet = workbook.getPrimarySheet() sheet.setTitle("My Mind Map") # Save to original path xmind.save(workbook) # Or save to a different path xmind.save(workbook, "my_mindmap_copy.xmind") ``` -------------------------------- ### Load and Save XMind Files with Python SDK Source: https://github.com/xmindltd/xmind-sdk-python/blob/master/README.md Demonstrates how to load an existing XMind file or create a new one, and how to save the modified workbook. The `xmind.load` function requires a file path with a '.xmind' extension, and `xmind.save` can take an optional path. ```python import xmind workbook = xmind.load(/path/to/file/) # Requires '.xmind' extension xmind.save(workbook) # or xmind.save(workbook, /save/file/to/path) ``` -------------------------------- ### Create Sheets and Root Topics in XMind with Python Source: https://context7.com/xmindltd/xmind-sdk-python/llms.txt Shows how to create multiple sheets within an XMind workbook and configure their respective root topics using the XMind SDK for Python. This is essential for organizing complex mind maps with distinct sections. ```python import xmind workbook = xmind.load("project_plan.xmind") # Get and configure the primary (first) sheet primary_sheet = workbook.getPrimarySheet() primary_sheet.setTitle("Project Overview") root_topic = primary_sheet.getRootTopic() root_topic.setTitle("Q4 Product Launch") # Create and add a second sheet second_sheet = workbook.createSheet() second_sheet.setTitle("Marketing Strategy") second_root = second_sheet.getRootTopic() second_root.setTitle("Campaign Plan") workbook.addSheet(second_sheet) xmind.save(workbook, "project_plan.xmind") ``` -------------------------------- ### Add Notes to Topics using Python XMind SDK Source: https://context7.com/xmindltd/xmind-sdk-python/llms.txt Attaches plain text notes to topics for additional context. This is useful for including detailed explanations or supplementary information without cluttering the main topic title. Requires the 'xmind' library. ```python import xmind from xmind.core.topic import TopicElement workbook = xmind.load("meeting_notes.xmind") sheet = workbook.getPrimarySheet() root = sheet.getRootTopic() root.setTitle("Q1 Planning Meeting") # Create topic with detailed notes action_item = TopicElement() action_item.setTitle("Improve API Performance") action_item.setPlainNotes( "Action: Optimize database queries and add caching layer.\n" "Owner: Backend Team\n" "Deadline: End of Q1\n" "Expected improvement: 50% reduction in response time" ) root.addSubTopic(action_item) # Create another topic with notes decision = TopicElement() decision.setTitle("Technology Stack Decision") decision.setPlainNotes( "Decided to use:\n" "- Python 3.11\n" "- PostgreSQL 15\n" "- React 18\n" "Rationale: Better performance and team expertise" ) root.addSubTopic(decision) xmind.save(workbook, "meeting_notes.xmind") ``` -------------------------------- ### Set Internal Topic Hyperlinks using Python XMind SDK Source: https://context7.com/xmindltd/xmind-sdk-python/llms.txt Creates navigation links between topics within the same XMind workbook. This allows users to jump between different sheets or topics. Requires the 'xmind' library. ```python import xmind from xmind.core.topic import TopicElement workbook = xmind.load("navigation.xmind") # Create first sheet with a topic first_sheet = workbook.getPrimarySheet() first_sheet.setTitle("Home") first_root = first_sheet.getRootTopic() first_root.setTitle("Main Dashboard") # Create second sheet second_sheet = workbook.createSheet() second_sheet.setTitle("Details") second_root = second_sheet.getRootTopic() second_root.setTitle("Detailed Information") workbook.addSheet(second_sheet) # Add topic in first sheet that links to second sheet nav_topic = TopicElement() nav_topic.setTitle("Go to Details Page") nav_topic.setTopicHyperlink(second_sheet.getID()) first_root.addSubTopic(nav_topic) # Add back navigation in second sheet back_topic = TopicElement() back_topic.setTitle("Back to Dashboard") back_topic.setTopicHyperlink(first_sheet.getID()) second_root.addSubTopic(back_topic) xmind.save(workbook, "navigation.xmind") ``` -------------------------------- ### Build Topic Hierarchies with Subtopics in XMind using Python Source: https://context7.com/xmindltd/xmind-sdk-python/llms.txt Illustrates how to construct hierarchical mind map structures by adding subtopics to parent topics using the XMind SDK for Python. This enables the creation of detailed and nested information within a mind map. ```python import xmind from xmind.core.topic import TopicElement workbook = xmind.load("team_structure.xmind") sheet = workbook.getPrimarySheet() sheet.setTitle("Company Organization") root = sheet.getRootTopic() root.setTitle("Engineering Team") # Create and add subtopics backend_topic = TopicElement() backend_topic.setTitle("Backend Team") root.addSubTopic(backend_topic) frontend_topic = TopicElement() frontend_topic.setTitle("Frontend Team") root.addSubTopic(frontend_topic) # Add nested subtopics (third level) python_dev = TopicElement() python_dev.setTitle("Python Developers") backend_topic.addSubTopic(python_dev) react_dev = TopicElement() react_dev.setTitle("React Developers") frontend_topic.addSubTopic(react_dev) xmind.save(workbook, "team_structure.xmind") ``` -------------------------------- ### Set File Hyperlinks on Topics using Python XMind SDK Source: https://context7.com/xmindltd/xmind-sdk-python/llms.txt Links topics to local files such as documents or images. This functionality is helpful for attaching local resources directly to mind map topics. Requires the 'xmind' library. ```python import xmind from xmind.core.topic import TopicElement workbook = xmind.load("project_assets.xmind") sheet = workbook.getPrimarySheet() root = sheet.getRootTopic() root.setTitle("Project Assets") # Create topics with file hyperlinks logo_topic = TopicElement() logo_topic.setTitle("Company Logo") logo_topic.setFileHyperlink("assets/logo.png") root.addSubTopic(logo_topic) spec_topic = TopicElement() spec_topic.setTitle("Technical Specification") spec_topic.setFileHyperlink("/home/user/docs/spec.pdf") root.addSubTopic(spec_topic) config_topic = TopicElement() config_topic.setTitle("Configuration File") config_topic.setFileHyperlink("config/settings.json") root.addSubTopic(config_topic) xmind.save(workbook, "project_assets.xmind") ``` -------------------------------- ### Create Relationships Between Topics using Python XMind SDK Source: https://context7.com/xmindltd/xmind-sdk-python/llms.txt Establishes visual relationships between topics on the same sheet to indicate connections or dependencies. This feature helps to visually represent the structure and flow of information. Requires the 'xmind' library. ```python import xmind from xmind.core.topic import TopicElement workbook = xmind.load("dependencies.xmind") sheet = workbook.getPrimarySheet() sheet.setTitle("Project Dependencies") root = sheet.getRootTopic() root.setTitle("Software Architecture") # Create topics database_topic = TopicElement() database_topic.setTitle("Database Layer") root.addSubTopic(database_topic) api_topic = TopicElement() api_topic.setTitle("API Layer") root.addSubTopic(api_topic) frontend_topic = TopicElement() frontend_topic.setTitle("Frontend Layer") root.addSubTopic(frontend_topic) # Create relationships showing dependencies rel1 = sheet.createRelationship( database_topic.getID(), api_topic.getID(), "provides data" ) sheet.addRelationship(rel1) rel2 = sheet.createRelationship( api_topic.getID(), frontend_topic.getID(), "serves endpoints" ) sheet.addRelationship(rel2) xmind.save(workbook, "dependencies.xmind") ``` -------------------------------- ### Set URL Hyperlinks on Topics using Python XMind SDK Source: https://context7.com/xmindltd/xmind-sdk-python/llms.txt Adds external URL hyperlinks to topics within an XMind workbook. This is useful for linking to online resources or documentation. Requires the 'xmind' library. ```python import xmind from xmind.core.topic import TopicElement workbook = xmind.load("resources.xmind") sheet = workbook.getPrimarySheet() root = sheet.getRootTopic() root.setTitle("Development Resources") # Create topics with URL hyperlinks docs_topic = TopicElement() docs_topic.setTitle("Official Documentation") docs_topic.setURLHyperlink("https://developer.mozilla.org") root.addSubTopic(docs_topic) tutorial_topic = TopicElement() tutorial_topic.setTitle("Python Tutorial") tutorial_topic.setURLHyperlink("https://docs.python.org/3/tutorial/") root.addSubTopic(tutorial_topic) github_topic = TopicElement() github_topic.setTitle("GitHub Repository") github_topic.setURLHyperlink("https://github.com/xmindltd/xmind-sdk-python") root.addSubTopic(github_topic) xmind.save(workbook, "resources.xmind") ``` -------------------------------- ### Add Markers to Topics in XMind using Python Source: https://context7.com/xmindltd/xmind-sdk-python/llms.txt Explains how to add various visual markers, such as stars, priorities, flags, and smileys, to topics within an XMind mind map using the XMind SDK for Python. This enhances the visual representation and status tracking of mind map elements. ```python import xmind from xmind.core.topic import TopicElement workbook = xmind.load("status_board.xmind") sheet = workbook.getPrimarySheet() root = sheet.getRootTopic() root.setTitle("Task Status Dashboard") # Create topics with different markers high_priority = TopicElement() high_priority.setTitle("Critical Bug Fix") high_priority.addMarker("priority-1") high_priority.addMarker("flag-red") root.addSubTopic(high_priority) completed = TopicElement() completed.setTitle("Database Migration") completed.addMarker("task-done") completed.addMarker("smiley-smile") root.addSubTopic(completed) in_progress = TopicElement() in_progress.setTitle("API Development") in_progress.addMarker("task-half") in_progress.addMarker("star-yellow") root.addSubTopic(in_progress) xmind.save(workbook, "status_board.xmind") ``` -------------------------------- ### Iterate and Modify Subtopics in XMind with Python Source: https://context7.com/xmindltd/xmind-sdk-python/llms.txt Demonstrates how to retrieve and iterate through subtopics of a given topic to perform batch modifications, such as adding markers, using the XMind SDK for Python. This is useful for applying consistent changes across multiple related topics. ```python import xmind from xmind.core.topic import TopicElement workbook = xmind.load("tasks.xmind") sheet = workbook.getPrimarySheet() root = sheet.getRootTopic() root.setTitle("Project Tasks") # Add several task topics tasks = ["Design Database", "Implement API", "Create UI", "Write Tests"] for task_name in tasks: task_topic = TopicElement() task_topic.setTitle(task_name) root.addSubTopic(task_topic) # Iterate through subtopics and add markers subtopics = root.getSubTopics() if subtopics: for topic in subtopics: # Add a priority marker to each task topic.addMarker("priority-1") print(f"Added marker to: {topic.getTitle()}") xmind.save(workbook, "tasks.xmind") ``` -------------------------------- ### Python: Manage Multiple Sheets in XMind Source: https://context7.com/xmindltd/xmind-sdk-python/llms.txt Demonstrates how to create, add, remove, and reorder sheets within an XMind workbook using the SDK. This is useful for organizing complex mind maps into distinct sections. Requires the 'xmind' library. ```python import xmind workbook = xmind.load("multi_sheet.xmind") # Create and add multiple sheets for i in range(1, 4): sheet = workbook.createSheet() sheet.setTitle(f"Phase {i}") root = sheet.getRootTopic() root.setTitle(f"Phase {i} Planning") workbook.addSheet(sheet) # Get all sheets all_sheets = workbook.getSheets() print(f"Total sheets: {len(all_sheets)}") for idx, sheet in enumerate(all_sheets): print(f"Sheet {idx}: {sheet.getTitle()}") # Move a sheet (move sheet at index 2 to index 1) workbook.moveSheet(2, 1) # Remove a sheet if len(all_sheets) > 1: workbook.removeSheet(all_sheets[-1]) xmind.save(workbook, "multi_sheet.xmind") ``` -------------------------------- ### Python: Set Topic Positions in XMind Source: https://context7.com/xmindltd/xmind-sdk-python/llms.txt Manually position topics at specific coordinates on the mind map canvas using the XMind SDK. This allows for precise visual control over topic placement. It requires the 'xmind' library. ```python import xmind from xmind.core.topic import TopicElement workbook = xmind.load("layout.xmind") sheet = workbook.getPrimarySheet() root = sheet.getRootTopic() root.setTitle("Custom Layout") # Create topics with specific positions topic1 = TopicElement() topic1.setTitle("Northwest Quadrant") topic1.setPosition(-200, -150) root.addSubTopic(topic1) topic2 = TopicElement() topic2.setTitle("Northeast Quadrant") topic2.setPosition(200, -150) root.addSubTopic(topic2) topic3 = TopicElement() topic3.setTitle("Southwest Quadrant") topic3.setPosition(-200, 150) root.addSubTopic(topic3) topic4 = TopicElement() topic4.setTitle("Southeast Quadrant") topic4.setPosition(200, 150) root.addSubTopic(topic4) # Check position of a topic pos = topic1.getPosition() if pos: print(f"Topic position: x={pos[0]}, y={pos[1]}") xmind.save(workbook, "layout.xmind") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.