Code Monkey home page Code Monkey logo

reflexify's People

Contributors

lineindent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

darkyxz

reflexify's Issues

Header isn't being updated

I followed your instruction and new pages are created when I edit the config file to add a new page, but nothing is added to the header/navigation. I can edit my url and the newly created page opens correctly. Is there a bug or am I missing something?

PermissionError: [WinError 5] Access is denied: ...

Does this work on windows 10?

After successfully run 'reflex init', and run rf-init I got this error message.

(venv) PS F:\Project\temperature> rf-init
Setting up Reflexify directory...
Source directory created successfully.
Configuring rxconfig.py file...
Traceback (most recent call last):
  File "F:\python_3.10.2\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "F:\python_3.10.2\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "F:\Project\temperature\venv\Scripts\rf-init.exe\__main__.py", line 7, in <module>
  File "F:\Project\temperature\venv\lib\site-packages\click\core.py", line 1157, in __call__       
  File "F:\Project\temperature\venv\lib\site-packages\click\core.py", line 1078, in main
  File "F:\Project\temperature\venv\lib\site-packages\click\core.py", line 1434, in invoke
  File "F:\Project\temperature\venv\lib\site-packages\click\core.py", line 783, in invoke
  File "F:\Project\temperature\venv\lib\site-packages\reflexify_scripts\create.py", line 108, in create
  File "F:\Project\temperature\venv\lib\site-packages\reflexify_scripts\create.py", line 83, in change_rx_config_details
  File "F:\python_3.10.2\lib\shutil.py", line 749, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "F:\python_3.10.2\lib\shutil.py", line 614, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "F:\python_3.10.2\lib\shutil.py", line 614, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "F:\python_3.10.2\lib\shutil.py", line 619, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "F:\python_3.10.2\lib\shutil.py", line 617, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'F:\\Project\\temperature\\venv\\Scripts\\python.exe'

How to add a component with event handler?

I created an app menu item for a sample counter and temperature components that I would like to add. I clone the repo and have not use the rf-init command. I am on windows 10.

config.py

"navigation": {
    "home": {
        "getting started": "start.py"
    },
    "app": {
        "introduction": "intro.py",
        "temperature": "temperature.py",
        "counter": "counter.py",
    }
},

image

The counter.py has this entry.

# Main content area: takes in rx.Componenets and passes them to base file
def __components__(self):
    return [
        # add your components below #
        CounterComponent()
        # end your components above #
    ]

That CounterComponent() is an import from my content folder.

from content.counter import CounterComponent

The content folder is under the reflexify folder.

image

My content/counter.py

from app.states.mainState import MainState
import reflex as rx


class CounterState(MainState):
    count: int = 0

    def increment(self):
        self.count += 1

    def decrement(self):
        self.count -= 1


def CounterComponent():
    return rx.box(
        rx.text('Counter App', font_size='1.5em'),
        rx.spacer(),
        rx.hstack(
            rx.button(rx.icon(tag='add'), color='green',
                      on_click=CounterState.increment
            ),
            rx.text(CounterState.count),
            rx.button(rx.icon(tag='minus'), color='red',
                      on_click=CounterState.decrement
            )
        )
    )

What is the issue?

The issue is that when you press the plus or minus button, the counter is unresponsive, meaning if you press the plus sign, the counter shown will not change, similar to minus sign.

image

fixing for the above bug in windows

Step - 1:
def change_rx_config_details():
dir_name = os.path.basename(os.getcwd()) # changed
for file in os.listdir(os.getcwd()):
if file == "rxconfig.py":
file_path = os.path.join(os.getcwd(), file)
with open(file_path, "r") as rder:
config = rder.read()
config = config.replace(f"{dir_name}", "app")
with open(file_path, "w") as wter:
wter.write(config)
remove_folder = os.path.join(os.getcwd(), dir_name)
shutil.rmtree(remove_folder)

Step - 2:
def create_src_file_structure():
source = os.path.join(Path(file).parent.parent, "app")
replicate = Path("./app")
def create_dir_file_structure(dir_path: str, key: str, files):
os.makedirs(dir_path,exist_ok=True)
for file in files:
source_path = os.path.join(source, key, file)
replicate_path = os.path.join(dir_path, file)
if os.path.exists(source_path):
with open(source_path, "r") as src_file, open(replicate_path, "w") as dst_file:
dst_file.write(src_file.read())
else:
os.makedirs(os.path.dirname(replicate_path), exist_ok=True) # Create directory if it doesn't exist
with open(replicate_path, "w") as dst_file:
pass # Create an empty file
for key, value in file_structure.items():
if value is not None:
dir_path = os.path.join(replicate, key)
if isinstance(value, list):
create_dir_file_structure(dir_path, key, value)
else:
source_file = os.path.join(source, key)
file_path = os.path.join(replicate, key)
if os.path.exists(source_file):
with open(source_file, "r") as src_file, open(file_path, "w") as dst_file:
dst_file.write(src_file.read())
else:
os.makedirs(os.path.dirname(file_path), exist_ok=True) # Create directory if it doesn't exist
with open(file_path, "w") as dst_file:
pass # Create an empty file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.