Skip to content

Commit

Permalink
Merge pull request #28 from mostypc123/find_jumptoline_highlightselected
Browse files Browse the repository at this point in the history
v4.1.0
  • Loading branch information
mostypc123 authored Dec 4, 2024
2 parents ff91a51 + 3f832d6 commit 1facfa4
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 14 deletions.
68 changes: 59 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,62 @@
### Contributing
# Contributing

## How to Contribute
To contribute:
- Create a fork of the repository. Name it ```fork-XediX```, ```XediX-fork```, ```XediX-forked``` or something similar, but **not** ```XediX```.
- Then, you can make changes in the fork.
- Write a pull request, with a description that is as much detailed as you can. You are allowed to use AI for the description, **but it should be clear and true**.
- If you think it is a high priority PR, write @mostypc123 somwhere in the description.
- Create a fork of the repository. Name it with a variation like ```fork-XediX```, ```XediX-fork```, ```XediX-forked```, but **not** ```XediX```.
- Make your changes in the forked repository.
- Write a pull request with a description that is **at least 20 characters long**.
- If the description is too short, the PR review process will fail.
- You are allowed to use AI for the description, but it must be clear and true.
- If your PR is a work in progress, prefix the title with ```[WIP]``` to skip the review process.
- If you believe this is a high-priority PR or a bug fix, mention @mostypc123 somewhere in the description.

## PR Guidelines
- Aim to modify fewer than 20 files in a single PR.
- If your PR involves breaking changes, explicitly mention "breaking change" in the description.

## PR Review Process
- We use a GitHub Action for automated PR reviews.
- The action checks:
- PR description length
- Number of modified files
- Automatic labeling based on description content
- PRs prefixed with ```[WIP]``` will automatically bypass the review process.

## Frequently Asked Questions

### Where is the source code?
You can find the source code in the `src/` folder.

### Can I use AI to help me write code?
Yes, but ensure that:
- You understand and can explain the code you're submitting
- You give appropriate credit if using AI-generated code

### What coding standards should I follow?
No formal coding standards are established yet. Generally:
- Write clean, readable code
- Add comments where necessary
- Follow common best practices for the language you're using

### How do I report a bug?
Open an issue in the GitHub repository with:
- A clear, descriptive title
- Steps to reproduce the bug
- Expected vs. actual behavior
- Any relevant error messages or screenshots

### Can I suggest new features?
Absolutely! Open an issue describing:
- The feature you're proposing
- Why you think it would be valuable
- Any initial thoughts on implementation

### How long does it take for a PR to be reviewed?
Review times vary. Our GitHub Action provides initial automated checks, and maintainers will review the PR afterward.

### FAQ
**Where is the source code?**
You can find it in the src/ folder.
### I'm new to open source. How can I contribute?
- Read these guidelines carefully
- Start with small, manageable contributions
- Don't be afraid to ask questions in the issues

_Nothing else yet. Want to ask a question? Ask in Issues._
*Have a question not answered here? Open an issue and ask.*
89 changes: 84 additions & 5 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import threading
import pywinstyles
import psutil
import webbrowser

import extension_menubar
import extension_mainfn
Expand Down Expand Up @@ -37,15 +38,17 @@ def InitUI(self):
'[': ']',
'{': '}',
'"': '"',
"'": "'"
"'": "'",
",":" ",
"self":".",
"#":" "
}

# Create the status bar
self.CreateStatusBar()
self.CreateStatusBar(3)

# Customize the appearance of the status bar
status_bar = self.GetStatusBar()
status_bar.SetBackgroundColour(wx.Colour(186, 210, 234))

# Display a welcome message in the status bar
self.SetStatusText("Welcome to XediX")
Expand Down Expand Up @@ -101,13 +104,21 @@ def CreateMenuBar(self):
copy_item = editMenu.Append(wx.ID_COPY, '&Copy\tCtrl+C', 'Copy selection')
paste_item = editMenu.Append(wx.ID_PASTE, '&Paste\tCtrl+V', 'Paste from clipboard')
find_replace_item = editMenu.Append(wx.ID_FIND, '&Find and Replace\tCtrl+F', 'Find and replace text')
jump_line_item = editMenu.Append(wx.ID_ANY, '&Jump to Line\tCtrl+G', 'Jump to a specific line number')

toolsMenu = wx.Menu()
tools_item = toolsMenu.Append(wx.ID_ANY, '&Tools\tCtrl+T', 'Run Tools')

helpMenu = wx.Menu()
homepage_item = helpMenu.Append(wx.ID_ANY, "&Homepage", "Homepage")
about_item = helpMenu.Append(wx.ID_ABOUT, '&About', 'About')
docs_item = helpMenu.Append(wx.ID_ANY, "&Docs", "Open Documentation")


menubar.Append(fileMenu, '&File')
menubar.Append(editMenu, '&Edit')
menubar.Append(toolsMenu,'&Tools')
menubar.Append(helpMenu, '&Help')
self.SetMenuBar(menubar)

self.Bind(wx.EVT_MENU, self.OnSave, save_item)
Expand All @@ -119,10 +130,68 @@ def CreateMenuBar(self):
self.Bind(wx.EVT_MENU, self.OnPaste, paste_item)
self.Bind(wx.EVT_MENU, self.OnRunPylint, pylint_item)
self.Bind(wx.EVT_MENU, self.OnFindReplace, find_replace_item)

self.Bind(wx.EVT_MENU, self.OnJumpToLine, jump_line_item)
self.Bind(wx.EVT_MENU, self.About, about_item)
self.Bind(wx.EVT_MENU, self.Docs, docs_item)
self.Bind(wx.EVT_MENU, self.Homepage, homepage_item)
extension_menubar.main()


# The following functions are opening webpages
def About(self, event):
self.SetStatusText("Opening webpage...", 2)
time.sleep(1)
webbrowser.open("https://xedix.w3spaces.com/about.html")
self.SetStatusText("Webpage opened", 2)

def Docs(self, event):
self.SetStatusText("Opening webpage...", 2)
time.sleep(1)
webbrowser.open("https://github.com/mostypc123/XediX/wiki")
self.SetStatusText("Webpage opened", 2)

def Homepage(self, event):
self.SetStatusText("Opening webpage...", 2)
time.sleep(1)
webbrowser.open("https://xedix.w3spaces.com")
self.SetStatusText("Webpage opened", 2)

def OnJumpToLine(self, event):
current_tab = self.notebook.GetCurrentPage()
if current_tab:
text_area = current_tab.GetChildren()[0]

# Create a dialog to get the line number
line_dialog = wx.TextEntryDialog(self, "Enter line number:", "Jump to Line")

if line_dialog.ShowModal() == wx.ID_OK:
try:
# Convert the input to an integer line number
line_number = int(line_dialog.GetValue()) - 1 # Adjust for 0-based indexing

# Get the position of the specified line
line_pos = text_area.PositionFromLine(line_number)

# Scroll to the line and set the cursor
text_area.GotoPos(line_pos)
text_area.SetFocus()

# Optional: Highlight the line
text_area.EnsureCaretVisible()
text_area.SetSelection(line_pos, text_area.GetLineEndPosition(line_number))

# Update status bar
self.SetStatusText(f"Jumped to line {line_number + 1}")

except ValueError:
# Handle invalid input
wx.MessageBox("Please enter a valid line number", "Error", wx.OK | wx.ICON_ERROR)
except Exception as e:
# Handle any other potential errors
wx.MessageBox(f"Error jumping to line: {str(e)}", "Error", wx.OK | wx.ICON_ERROR)

line_dialog.Destroy()

def run_tools_script(self, event):
try:
result = subprocess.run(["./tools.exe"], capture_output=True, text=True)
Expand Down Expand Up @@ -196,7 +265,8 @@ def PopulateFileList(self):
self.file_list.AppendItems(files)

def OnChar(self, event):
self.SetStatusText("Character pressed, showing recommendations")
self.SetStatusText("Character pressed",2)
self.SetStatusText("Showing recomendations")
current_tab = self.notebook.GetCurrentPage()
if current_tab:
text_area = current_tab.GetChildren()[0]
Expand Down Expand Up @@ -267,6 +337,7 @@ def OnFileOpen(self, event):
text_area.StyleClearAll() # Apply the default style to all text

if file_name.endswith(".py"):
self.SetStatusText("Python", 1)

# Set up Python syntax highlighting
text_area.SetLexer(stc.STC_LEX_PYTHON)
Expand Down Expand Up @@ -295,6 +366,7 @@ def OnFileOpen(self, event):
text_area.StyleSetSpec(stc.STC_P_DECORATOR, "fore:#C586C0,italic,back:#1E1E1E")

elif file_name.endswith(".html"):
self.SetStatusText("HTML", 1)
# Set up HTML syntax highlighting
text_area.SetLexer(stc.STC_LEX_HTML)

Expand All @@ -320,6 +392,7 @@ def OnFileOpen(self, event):
text_area.StyleSetSpec(stc.STC_H_OTHER, "fore:#D4D4D4,bold,back:#1E1E1E")

elif file_name.endswith(".json"):
self.SetStatusText("JSON", 1)
# Set up JSON syntax highlighting
text_area.SetLexer(stc.STC_LEX_JSON)

Expand All @@ -335,6 +408,7 @@ def OnFileOpen(self, event):
# Keywords (e.g., true, false, null)
text_area.StyleSetSpec(stc.STC_JSON_KEYWORD, "fore:#68C147,bold,back:#1E1E1E")
elif file_name.endswith(".css"):
self.SetStatusText("CSS", 1)
# Set up CSS syntax highlighting
text_area.SetLexer(stc.STC_LEX_CSS)

Expand Down Expand Up @@ -368,6 +442,7 @@ def OnFileOpen(self, event):
text_area.StyleSetSpec(stc.STC_CSS_DIRECTIVE, "fore:#68C147,bold,back:#1E1E1E")

elif file_name.endswith(".js"):
self.SetStatusText("Javascript", 1)
# Set up JavaScript syntax highlighting
text_area.SetLexer(stc.STC_LEX_ESCRIPT)

Expand Down Expand Up @@ -591,6 +666,8 @@ def export_to_html(self, log_filename, output_message, return_visualization):
with open(log_filename, 'w') as log_file:
log_file.write(html_content)

self.SetStatusText(f"Saved execution log to: {log_filename}")

def OnSave(self, event):
current_tab = self.notebook.GetCurrentPage()
if current_tab:
Expand All @@ -613,6 +690,8 @@ def OnSave(self, event):
file.write(content)

def OnExit(self, event):
self.SetStatusText("Exiting XediX...")
time.sleep(1)
self.Close()

def OnCut(self, event):
Expand Down
1 change: 1 addition & 0 deletions src/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ json
markdown
pyperclip
psutil
webbrowser

0 comments on commit 1facfa4

Please sign in to comment.