Update changes
Dieser Commit ist enthalten in:
@ -651,10 +651,17 @@ pause
|
|||||||
else:
|
else:
|
||||||
self._start_activity()
|
self._start_activity()
|
||||||
|
|
||||||
def update_activity_status(self, is_active: bool = False, user_name: str = None):
|
def update_activity_status(self, is_active: bool = False, user_name: str = None, is_own_activity: bool = False):
|
||||||
"""Update activity indicator on tile"""
|
"""Update activity indicator on tile"""
|
||||||
if is_active:
|
if is_active:
|
||||||
# Show indicator
|
# Show indicator with appropriate color
|
||||||
|
if is_own_activity:
|
||||||
|
# Green for own activity
|
||||||
|
self.activity_indicator.configure(text="🟢", text_color=COLORS['accent_success'])
|
||||||
|
else:
|
||||||
|
# Orange for others' activity
|
||||||
|
self.activity_indicator.configure(text="🟠", text_color=COLORS['accent_warning'])
|
||||||
|
|
||||||
self.activity_indicator.pack(side="left", padx=(0, 5))
|
self.activity_indicator.pack(side="left", padx=(0, 5))
|
||||||
if user_name:
|
if user_name:
|
||||||
# Create tooltip with user name
|
# Create tooltip with user name
|
||||||
@ -664,7 +671,11 @@ pause
|
|||||||
|
|
||||||
# Update activity button if exists
|
# Update activity button if exists
|
||||||
if hasattr(self, 'activity_button'):
|
if hasattr(self, 'activity_button'):
|
||||||
self.activity_button.configure(text="⏹")
|
if is_own_activity:
|
||||||
|
self.activity_button.configure(text="⏹")
|
||||||
|
else:
|
||||||
|
# Keep play button if someone else is active
|
||||||
|
self.activity_button.configure(text="▶")
|
||||||
else:
|
else:
|
||||||
# Hide indicator
|
# Hide indicator
|
||||||
self.activity_indicator.pack_forget()
|
self.activity_indicator.pack_forget()
|
||||||
@ -680,14 +691,25 @@ pause
|
|||||||
self.tooltip.wm_overrideredirect(True)
|
self.tooltip.wm_overrideredirect(True)
|
||||||
self.tooltip.configure(fg_color=COLORS['bg_secondary'])
|
self.tooltip.configure(fg_color=COLORS['bg_secondary'])
|
||||||
|
|
||||||
|
# Format text for multiple users
|
||||||
|
if ", " in user_name:
|
||||||
|
users = user_name.split(", ")
|
||||||
|
if len(users) == 1:
|
||||||
|
text = f"{users[0]} arbeitet hieran"
|
||||||
|
else:
|
||||||
|
text = f"{len(users)} Personen arbeiten hieran:\n" + "\n".join(f"• {u}" for u in users)
|
||||||
|
else:
|
||||||
|
text = f"{user_name} arbeitet hieran"
|
||||||
|
|
||||||
label = ctk.CTkLabel(
|
label = ctk.CTkLabel(
|
||||||
self.tooltip,
|
self.tooltip,
|
||||||
text=f"{user_name} arbeitet hieran",
|
text=text,
|
||||||
font=FONTS['small'],
|
font=FONTS['small'],
|
||||||
text_color=COLORS['text_primary'],
|
text_color=COLORS['text_primary'],
|
||||||
fg_color=COLORS['bg_secondary']
|
fg_color=COLORS['bg_secondary'],
|
||||||
|
justify="left"
|
||||||
)
|
)
|
||||||
label.pack(padx=5, pady=2)
|
label.pack(padx=8, pady=5)
|
||||||
|
|
||||||
# Position tooltip
|
# Position tooltip
|
||||||
x = self.activity_indicator.winfo_rootx()
|
x = self.activity_indicator.winfo_rootx()
|
||||||
@ -703,9 +725,26 @@ pause
|
|||||||
"""Check if this project has active users"""
|
"""Check if this project has active users"""
|
||||||
from services.activity_sync import activity_service
|
from services.activity_sync import activity_service
|
||||||
|
|
||||||
activity = activity_service.is_project_active(self.project.name)
|
# Get all activities for this project
|
||||||
if activity:
|
active_users = []
|
||||||
self.update_activity_status(True, activity.get('userName'))
|
is_own_activity = False
|
||||||
|
has_other_users = False
|
||||||
|
|
||||||
|
for activity in activity_service.activities:
|
||||||
|
if activity.get('projectName') == self.project.name and activity.get('isActive'):
|
||||||
|
user_name = activity.get('userName', 'Unknown')
|
||||||
|
active_users.append(user_name)
|
||||||
|
# Check if it's the current user's activity
|
||||||
|
if activity.get('userId') == activity_service.user_id:
|
||||||
|
is_own_activity = True
|
||||||
|
else:
|
||||||
|
has_other_users = True
|
||||||
|
|
||||||
|
if active_users:
|
||||||
|
# Show indicator with all active users
|
||||||
|
user_text = ", ".join(active_users)
|
||||||
|
# If both own and others are active, show as others (orange) to indicate collaboration
|
||||||
|
self.update_activity_status(True, user_text, is_own_activity and not has_other_users)
|
||||||
else:
|
else:
|
||||||
self.update_activity_status(False)
|
self.update_activity_status(False)
|
||||||
|
|
||||||
|
|||||||
@ -74,6 +74,8 @@ class ActivitySyncService:
|
|||||||
def connect():
|
def connect():
|
||||||
logger.info("Connected to activity server")
|
logger.info("Connected to activity server")
|
||||||
self.connected = True
|
self.connected = True
|
||||||
|
# Fetch initial activities after connection
|
||||||
|
self._fetch_initial_activities()
|
||||||
|
|
||||||
@self.sio.event
|
@self.sio.event
|
||||||
def disconnect():
|
def disconnect():
|
||||||
@ -204,6 +206,18 @@ class ActivitySyncService:
|
|||||||
"""Get current user's activity"""
|
"""Get current user's activity"""
|
||||||
return self.current_activity
|
return self.current_activity
|
||||||
|
|
||||||
|
def _fetch_initial_activities(self):
|
||||||
|
"""Fetch initial activities after connection"""
|
||||||
|
try:
|
||||||
|
activities = self.get_activities()
|
||||||
|
if activities:
|
||||||
|
self.activities = activities
|
||||||
|
if self.on_activities_update:
|
||||||
|
self.on_activities_update(activities)
|
||||||
|
logger.info(f"Fetched {len(activities)} initial activities")
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Failed to fetch initial activities: {e}")
|
||||||
|
|
||||||
|
|
||||||
# Global instance
|
# Global instance
|
||||||
activity_service = ActivitySyncService()
|
activity_service = ActivitySyncService()
|
||||||
@ -231,22 +231,29 @@ class GitOperationsManager:
|
|||||||
return large_files
|
return large_files
|
||||||
|
|
||||||
def push(self, repo_path: Path, remote: str = "origin", branch: Optional[str] = None) -> Tuple[bool, str]:
|
def push(self, repo_path: Path, remote: str = "origin", branch: Optional[str] = None) -> Tuple[bool, str]:
|
||||||
|
# Get current branch first
|
||||||
|
branch_cmd = ["git", "branch", "--show-current"]
|
||||||
|
branch_success, current_branch, _ = self._run_git_command(branch_cmd, cwd=repo_path)
|
||||||
|
current_branch = current_branch.strip() if branch_success else ""
|
||||||
|
|
||||||
# First try regular push
|
# First try regular push
|
||||||
cmd = ["git", "push", remote]
|
cmd = ["git", "push", remote]
|
||||||
if branch:
|
if branch:
|
||||||
cmd.append(branch)
|
cmd.append(branch)
|
||||||
|
elif current_branch == "master":
|
||||||
|
# If we're on master and no branch specified, push to main
|
||||||
|
cmd.extend(["HEAD:main"])
|
||||||
|
|
||||||
success, stdout, stderr = self._run_git_command(cmd, cwd=repo_path)
|
success, stdout, stderr = self._run_git_command(cmd, cwd=repo_path)
|
||||||
|
|
||||||
# If push failed due to no upstream, try with --set-upstream
|
# If push failed due to no upstream or branch name mismatch, try with --set-upstream
|
||||||
if not success and ("has no upstream branch" in stderr or "The current branch" in stderr or "--set-upstream" in stderr):
|
if not success and ("has no upstream branch" in stderr or "The current branch" in stderr or
|
||||||
# Get current branch
|
"--set-upstream" in stderr or "does not match" in stderr):
|
||||||
branch_cmd = ["git", "branch", "--show-current"]
|
if current_branch:
|
||||||
branch_success, current_branch, _ = self._run_git_command(branch_cmd, cwd=repo_path)
|
|
||||||
|
|
||||||
if branch_success and current_branch.strip():
|
|
||||||
# Retry with --set-upstream
|
# Retry with --set-upstream
|
||||||
cmd = ["git", "push", "--set-upstream", remote, current_branch.strip()]
|
# If we're on master, push to main (common convention)
|
||||||
|
remote_branch = "main" if current_branch == "master" else current_branch
|
||||||
|
cmd = ["git", "push", "--set-upstream", remote, f"{current_branch}:{remote_branch}"]
|
||||||
success, stdout, stderr = self._run_git_command(cmd, cwd=repo_path)
|
success, stdout, stderr = self._run_git_command(cmd, cwd=repo_path)
|
||||||
|
|
||||||
# Check for specific errors
|
# Check for specific errors
|
||||||
@ -350,6 +357,15 @@ class GitOperationsManager:
|
|||||||
success, stdout, stderr = self._run_git_command(cmd, cwd=repo_path)
|
success, stdout, stderr = self._run_git_command(cmd, cwd=repo_path)
|
||||||
return success, stdout or stderr
|
return success, stdout or stderr
|
||||||
|
|
||||||
|
def remote(self, repo_path: Path, verbose: bool = False) -> Tuple[bool, str]:
|
||||||
|
"""Alias for remote_list for backward compatibility"""
|
||||||
|
if verbose:
|
||||||
|
return self.remote_list(repo_path)
|
||||||
|
else:
|
||||||
|
cmd = ["git", "remote"]
|
||||||
|
success, stdout, stderr = self._run_git_command(cmd, cwd=repo_path)
|
||||||
|
return success, stdout or stderr
|
||||||
|
|
||||||
def stash(self, repo_path: Path, message: Optional[str] = None) -> Tuple[bool, str]:
|
def stash(self, repo_path: Path, message: Optional[str] = None) -> Tuple[bool, str]:
|
||||||
cmd = ["git", "stash", "push"]
|
cmd = ["git", "stash", "push"]
|
||||||
if message:
|
if message:
|
||||||
|
|||||||
In neuem Issue referenzieren
Einen Benutzer sperren